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

Help wanted: Permission dialog not showing up in pgb #255

Closed
bigreni opened this issue Nov 20, 2017 · 2 comments
Closed

Help wanted: Permission dialog not showing up in pgb #255

bigreni opened this issue Nov 20, 2017 · 2 comments
Labels
help wanted Collaboration wanted on this issue

Comments

@bigreni
Copy link

bigreni commented Nov 20, 2017

I am using phonegap build. I am trying to get permission to access user location. I have added the geolocation plugin
<gap:plugin name="cordova-plugin-geolocation" source="npm"/>

I have also added the diagnostic plugin to my config.xml
<gap:plugin name="cordova.plugins.diagnostic" source="npm" />

This is my code that runs after my deviceready event
cordova.plugins.diagnostic.getLocationAuthorizationStatus(function (status) {
switch (status) {
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
cordova.plugins.diagnostic.requestLocationAuthorization(function (status) {
}, function (error) {
console.error(error);
});
break;
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
break;
case cordova.plugins.diagnostic.permissionStatus.DENIED:
cordova.plugins.diagnostic.requestLocationAuthorization(function (status) {
}, function (error) {
console.error(error);
});
break;
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
break;
}
}, function (error) {
console.error(error);
});

I would expect the user to get a popup when they first install the app asking them to grant permission. I have tested on a phone with Android 6 and there is no dialog. Can you please tell what am I doing incorrectly? Thank you for your help.

@dpa99c
Copy link
Owner

dpa99c commented Nov 20, 2017

Very probably related to #254:
TL;DR: Latest version of Phonegap Build CLI no longer supports <config-file> blocks to insert <uses-permission> into AndroidManifest.xml.

@dpa99c dpa99c added the help wanted Collaboration wanted on this issue label Nov 20, 2017
@bigreni
Copy link
Author

bigreni commented Nov 20, 2017

Thanks for pointing me to the other thread. I got it to work. I am using version pgb version 6.5 which supports . I added the following to my config.xml and it works.

xmlns:android="http://schemas.android.com/apk/res/android"
<gap:config-file platform="android" parent="/manifest" mode="add">


</gap:config-file>

Hopefully this will help other people using pgb.
Thank you again.

@bigreni bigreni closed this as completed Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Collaboration wanted on this issue
Projects
None yet
Development

No branches or pull requests

2 participants