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

Dialog not showing #20

Open
dioxmio opened this issue Dec 1, 2016 · 14 comments
Open

Dialog not showing #20

dioxmio opened this issue Dec 1, 2016 · 14 comments

Comments

@dioxmio
Copy link

dioxmio commented Dec 1, 2016

Hi,

the dialog isn't showing for me. The api of my app is 14 and the device which I'm trying on is on Android 6.0 version. I'm trying to get CAMERA permission for example. I have modified the plugin by adding another permission:
private String[] getPermissions(JSONArray permissions) { String[] stringArray = new String[permissions.length() + 1]; for (int i = 0; i < permissions.length(); i++) { try { stringArray[i] = permissions.getString(i); } catch (JSONException ignored) { //Believe exception only occurs when adding duplicate keys, so just ignore it } } stringArray[1] = Manifest.permission.READ_EXTERNAL_STORAGE; return stringArray; }

and this works: I can see both permission dialogs showing up.

If I hardcode this permission it does the job as well:

private String[] getPermissions(JSONArray permissions) { String[] stringArray = new String[permissions.length()]; for (int i = 0; i < permissions.length(); i++) { try { stringArray[i] = Manifest.permission.READ_EXTERNAL_STORAGE; } catch (JSONException ignored) { //Believe exception only occurs when adding duplicate keys, so just ignore it } } return stringArray; }

Hardcoding the Manifest.permission.CAMERA wouldn't work.In that scenario though.

Any ideas? I'm still confused why it wouldn't work on some scenarios and it would on others. Without tweaking the plugin I couldn't get it to work on any permission I requested.

@NeoLSN
Copy link
Owner

NeoLSN commented Dec 2, 2016

So you mean if you just only put camera permission will not work on your device and if you put more permissions with camera permission it will work, right?

@dioxmio
Copy link
Author

dioxmio commented Dec 3, 2016

Yes, for some reason I can see the permissions popup if I don t manually tweak the plugin and add an extra one. Do you know what might be the reason?

@dioxmio
Copy link
Author

dioxmio commented Dec 3, 2016

*can t

@NeoLSN
Copy link
Owner

NeoLSN commented Jan 4, 2017

I still can not reproduce this issue. Are you still facing this issue?

@talamaska
Copy link

Yes i specifically see this happening, not popup, and directly goes to error callback. haven't tried with multiple permissions.

@yshen65
Copy link

yshen65 commented Apr 14, 2017

I tested on an acer iconia 10 (android 6) with
permissions.requestPermission(permissions.ACCESS_FINE_LOCATION , success, error);
no popup either..
it go to ....
function success( status ) {
if( !status.hasPermission ) error(); // it goes to this one
}

@les-buchanan
Copy link

I'm also not seeing the permissions dialog when I'm running my app in the emulator. I do a checkPermissions and it goes to the success callback that looks like this:

    var permissionsSuccess = function(status) {
      if (status.hasPermission) {
        console.log("Yay! we got permission!");
      } else {
        console.log("Requesting permission.");
        permissions.requestPermission(permissions.PACKAGE_USAGE_STATS, (status) => {
          if( !status.hasPermission ) { permissionsError("You just can't win!") };
        }, permissionsError);
      }
    }

It immediately displays "Requesting permission." and then "You just can't win!" in the CLI console. Any help with this would be awesome!

@Kromas
Copy link

Kromas commented May 23, 2017

Same problem here today. The popup/dialog is just not showing for whatever reason. CheckPermissions works fine, however request just doesn't. I tried everything and it just doesn't work

@yuta-take
Copy link

yuta-take commented Jun 21, 2017

my issue has been resolved,

in my case I checked the use-permission on AndroidManifest.xml.
but missing the request permission on the AndroidManifest.xml.
I do not know the cause, but it was gone.

I added permission and it was displayed dialog.

@asadwaheed1
Copy link

Same issue when requesting permission permission dialog not showing. i checked the manifest permission is already there. And it goes directly goes to rejected without even asking. When using checkPermission method it retuns true even if permission not granted. This plugin is useless so far

@mlshv
Copy link

mlshv commented Nov 21, 2017

Had the same problem. Forgot to add video permission to Android Manifest after platfrom remove, platform add. Everyone having the same issue, double-check your AndroidManifest.xml, it should contain either one or both of these

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />

@talamaska
Copy link

I have found that my permission request call was called twice for some reason, probably ionic issue. I don't think I can reproduce it anymore.

@reedspool
Copy link

reedspool commented Jan 5, 2018

@mlshv Thank you so much! I'm a beginner and found this cordova plugin before researching Android permissions in general. I had no idea I needed this as well.

@NeoLSN Thanks for this plugin! Perhaps the manifest instructions can be included in README instructions?

For anyone in the future who, like me, is trying to use video and audio for WebRTC, in addition to RECORD_AUDIO and CAMERA, I also needed MODIFY_AUDIO_SETTINGS for audio to work:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />

@dcrousset
Copy link

Had the same problem. Ended by adding this in my config.xml (cordova 9+) :

...
<platform name="android">
    <config-file target="AndroidManifest.xml" parent="/manifest">
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    </config-file>
    ...
</platform>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests