Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20003

Permission request error response message prefixed with namespace

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 5.1.0
    • Fix Version/s: Release 5.1.2
    • Component/s: Android
    • Labels:
      None
    • Environment:

      SDK 5.1.0.v20151116104422

    • Story Points:
      2
    • Sprint:
      2015 Sprint 24 SDK

      Description

      The following code demonstrates that when you deny permission, the error messages in the callback payload are prefixed by the namespace followed by no spacing. Expected behaviour is not to have a prefix at all.

      var win = Ti.UI.createWindow({
      	backgroundColor: 'white'
      });
       
      var btn = Ti.UI.createButton({
      	title: 'Request Permissions'
      });
       
      btn.addEventListener('click', function(e) {
       
      	Ti.Calendar.requestCalendarPermissions(function(e) {
      		console.log('Ti.Calendar.requestCalendarPermissions ' + JSON.stringify(e, null, 2));
      	});
       
      	Ti.Contacts.requestContactsPermissions(function(e) {
      		console.log('Ti.Contacts.requestContactsPermissions ' + JSON.stringify(e, null, 2));
      	});
       
      	Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {
      		console.log('Ti.Geolocation.requestLocationPermissions ' + JSON.stringify(e, null, 2));
      	});
       
      	Ti.Media.requestCameraPermissions(function(e) {
      		console.log('Ti.Media.requestCameraPermissions ' + JSON.stringify(e, null, 2));
      	});
       
      });
       
      win.add(btn);
      win.open();
       
      // So the required users-permissions are added to AndroidManifest.xml
      function foo() {
      	Ti.Calendar.getAllCalendars();
      	Ti.Contacts.getAllGroups();
      	Ti.Media.showCamera();
      }
      

      Console

      11-17 14:11:46.421: I/TiAPI(5178):  Ti.Media.requestCameraPermissions {
      11-17 14:11:46.421: I/TiAPI(5178):   "error": "CameraOne or more permission(s) were denied",
      11-17 14:11:46.421: I/TiAPI(5178):   "code": -1,
      11-17 14:11:46.421: I/TiAPI(5178):   "success": false
      11-17 14:11:46.421: I/TiAPI(5178): }
      11-17 14:11:46.422: I/TiAPI(5178):  Ti.Geolocation.requestLocationPermissions {
      11-17 14:11:46.422: I/TiAPI(5178):   "error": "LocationOne or more permission(s) were denied",
      11-17 14:11:46.422: I/TiAPI(5178):   "code": -1,
      11-17 14:11:46.422: I/TiAPI(5178):   "success": false
      11-17 14:11:46.422: I/TiAPI(5178): }
      11-17 14:11:46.422: I/TiAPI(5178):  Ti.Contacts.requestContactsPermissions {
      11-17 14:11:46.422: I/TiAPI(5178):   "error": "ContactsOne or more permission(s) were denied",
      11-17 14:11:46.422: I/TiAPI(5178):   "code": -1,
      11-17 14:11:46.422: I/TiAPI(5178):   "success": false
      11-17 14:11:46.422: I/TiAPI(5178): }
      11-17 14:11:46.422: I/TiAPI(5178):  Ti.Calendar.requestCalendarPermissions {
      11-17 14:11:46.422: I/TiAPI(5178):   "error": "CalendarOne or more permission(s) were denied",
      11-17 14:11:46.422: I/TiAPI(5178):   "code": -1,
      11-17 14:11:46.422: I/TiAPI(5178):   "success": false
      11-17 14:11:46.422: I/TiAPI(5178): }
      

      Related code:
      https://github.com/appcelerator/titanium_mobile/blob/a0e6b6545594b64d95dc91a496e3242342de9db1/android/titanium/src/java/org/appcelerator/titanium/TiBaseActivity.java#L440

        Attachments

          Activity

            People

            • Assignee:
              fokkezb Fokke Zandbergen
              Reporter:
              fokkezb Fokke Zandbergen
              Reviewer:
              Hans Knöchel
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20692
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration