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

Android M: App crashes if using camera in device due to permissions

    Details

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

      Nexus 5
      Android Version 6

      Description

      The problem is, the app doesn't prompt the user for permissions, and even if the permissions are set, the app crashes.

      Steps to reproduce:

      1. Use the sample app
      2. ti build
      3. it will show an error
      4. Go to settings permissions, set the app permission such that storage = YES, camera = NO
      5. App will crash

      Note if both permissions are set to YES MANUALLY like (4.), the app works.

      Titanium.Media.showCamera({
      	success:function(event) {
      		// called when media returned from the camera
      		Ti.API.debug('Our type was: '+event.mediaType);
      		if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
      			var imageView = Ti.UI.createImageView({
      				width:win.width,
      				height:win.height,
      				image:event.media
      			});
      			win.add(imageView);
      		} else {
      			alert("got the wrong type back ="+event.mediaType);
      		}
      	},
      	cancel:function() {
      		// called when user cancels taking a picture
      	},
      	error:function(error) {
      		// called when there's an error
      		var a = Titanium.UI.createAlertDialog({title:'Camera'});
      		a.setMessage(JSON.stringify(error));
      		a.show();
      	},
      	saveToPhotoGallery:true
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                cng Chee Kiat Ng (Inactive)
                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-20294
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration