You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
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.
The text was updated successfully, but these errors were encountered: