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

Android: Permissions (Camera) crash and other bugs

    Details

    • Sprint:
      2015 Sprint 22 SDK

      Description

      The following sample will always call back with success:false without showing the dialog:

      if (Ti.Media.hasCameraPermissions()) {
      	return alert('You already have permission.');
      }
       
      Ti.Media.requestCameraPermissions(function(e) {
      	if (e.success) {
      		alert('You were granted permission.');
      	} else {
      		alert('ou were denied permission for now, forever or the dialog did not show at all because it was denied forever before.');
      	}
      });
      

      To make it work you need to declare the permission in tiapp.xml, which is not documented in either the Ti.Media Reference nor Camera and Photo Gallery APIs Guide or tiapp.xml Common Requirements.

        <android xmlns:android="http://schemas.android.com/apk/res/android">
          <manifest>
              <uses-permission android:name="android.permission.CAMERA" />
          </manifest>
        </android>
      

      If you do so Android 6+ will prompt for two permissions:

      The first time after each new install I deny either one of two the callback will receive success:true but the next call to Ti.Media.hasCameraPermissions() will still return false and Ti.Media.requestCameraPermissions() will again prompt for both permissions, including the one I already granted.

      After the first time I deny only one of two permissions, every next time I do the exact same thing the app crashes with the attached log as soon as I deny the first or second permission.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Ashraf Abu (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code