Camera permissions in Appcelerator
Asked Answered
P

1

6

I'm using Appcelerator studio for developing my app. In this app I'm taking photos from camera and posting them to my server. For Android 6, I'm asking run time permissions from users for using camera. My code is working fine. But, when I ask permission for camera on run time. It is asking 3 permissions,

  1. Allow app to take photos and record videos.
  2. App will access gallery.
  3. App will use camera location.

My question is why I'm seeing all these permissions when I'm only using camera for taking photos and how can I get rid of them?

Code snippet:

if (Ti.Media.hasCameraPermissions()) {
        openCamera();
    } else {
        Ti.Media.requestCameraPermissions(function(e) {
            if (e.success) {
                openCamera();
            } else {
                alert('You denied permission');
            }
        });
    }

Thanks in advance for help.

Polypody answered 6/6, 2016 at 12:47 Comment(5)
Just to clarify, you are talking about the new Android 6 permissions system, right? I have code almost identical to yours in an app, and I get two permissions dialogs. One says "Allow APPNAME to access photos, media, and files on your device?" and the other says "Allow APPNAME to take pictures and record video?" I'm not familiar with the "use camera location" permission. But my app does request location for other purposes at startup, so maybe that's why I'm not seeing that when I request camera permissions?Wilk
I think that is the way it is designed to work, ... and I think you are right @JasonPriebe :-)Futility
Inspection of the MediaModule.java in the Ti mobile SDK (github.com/appcelerator/titanium_mobile/blob/…) indicates that requestCameraPermissions() call asks only for Manifest.permission.CAMERA and Manifest.permission.READ_EXTERNAL_STORAGE. Nothing about location, so I'm not sure how the OP is getting a location permission prompt (unless there's are location permissions being requested in openCamera())Wilk
@Jason yes, it is about Android 6 permissions. And yes, I'm using location services and I've separate permissions for them. I'm more concerned why this permission is about camera location.Polypody
Possible duplicate of Not able to set permission in Android 7.0.0Langsdon
M
0

It could be due to the fact that you have not granted location permissions yet on Titanium checks to ask for permissions at once. Do try it after giving location permissions.

Measles answered 26/9, 2017 at 5:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.