Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera access example #25

Closed
digitalprecision opened this issue Oct 7, 2016 · 8 comments
Closed

Camera access example #25

digitalprecision opened this issue Oct 7, 2016 · 8 comments

Comments

@digitalprecision
Copy link

digitalprecision commented Oct 7, 2016

Seems easy enough:

protected void intentCamera()
{
    permissionHelper
        .setForceAccepting(false)
        .request(MULTI_PERMISSIONS); // CAMERA and WRITE_EXTERNAL_STORAGE

    showCamera();
}

But doesn't work as expected, as showCamera() is called regardless of the status of the permissions. Does showCamera() go into onRequestPermissionsResult()?

@k0shk0sh
Copy link
Owner

k0shk0sh commented Oct 8, 2016

It goes into the on permission granted callback, when the permission is granted you should start the camera. in ur above code, the method will always be called.

@digitalprecision
Copy link
Author

But that method handles a specific permission. For camera I need Camera and Write_External. How would I call cameraStart if one perm is camera but the next is Write_External? I need both to be granted then call cameraStart.

@k0shk0sh
Copy link
Owner

k0shk0sh commented Oct 8, 2016

You should be using one of permissionHelper methods to tell you if both
permissions are granted on permission granted callback ex: if
permissionHelper.isPermissionGranted(....) and
permissionHelper.isPermissionGranted(....) Do things.

On Oct 8, 2016 10:48 AM, "Mike Purcell" notifications@github.com wrote:

But that method handles a specific permission. For camera I need Camera
and Write_External. How would I call cameraStart if one perm is camera but
the next is Write_External? I need both to be granted then call cameraStart.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#25 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6o_-9ZvEep75UcvF1jokaV3ZBxGTRiks5qxwSWgaJpZM4KRcID
.

@digitalprecision
Copy link
Author

Ya I tried that first. But if u wrap startCamera with those perms it won't fire off if the perms were just granted. I have to click the button again then the camera opens.

@k0shk0sh
Copy link
Owner

k0shk0sh commented Oct 8, 2016

@OverRide public void onPermissionGranted(@nonnull String[] permissionName)
{ //do the checking here. This method will always be called if permissions
is granted. Its straight forward tbh }

On Oct 8, 2016 10:56 AM, "Mike Purcell" notifications@github.com wrote:

Ya I tried that first. But if u wrap startCamera with those perms it won't
fire off if the perms were just granted. I have to click the button again
then the camera opens.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#25 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6o_8Xd7aBEt7h_AtdIo-rQxERpXMkFks5qxwZ2gaJpZM4KRcID
.

@digitalprecision
Copy link
Author

For a single permission right? I can't call startCamera in that method for the reason I stated above. I need both perms to be granted.

@k0shk0sh
Copy link
Owner

k0shk0sh commented Oct 8, 2016

if you called request with multiple permissions, then that method method will return multiple permissions if they are granted.

public static List<String> declinedPermissionsAsList(@NonNull Context context, @NonNull String[] permissions) {

you might consider using that method onPermissionGranted this method will return you declined permissions, if its empty then both permissions are granted.

@digitalprecision
Copy link
Author

Dope I'll try that. Thanks.

@k0shk0sh k0shk0sh closed this as completed Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants