You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/10/20 06:48:28 UTC
[GitHub] kristofvdj88 edited a comment on issue #114: Not working on Android
devices
kristofvdj88 edited a comment on issue #114: Not working on Android devices
URL: https://github.com/apache/cordova-plugin-geolocation/issues/114#issuecomment-431554902
I had the same issues with Android devices and couldn't find a solution for this plugin. Luckily I found another very similar plugin that does work: [https://github.com/esri/cordova-plugin-advanced-geolocation]. But if you would like to primarily keep using the official plugin you could try this:
```
// OFFICIAL GEO PLUGIN
getLocationFirstTry = function() {
navigator.geolocation.getCurrentPosition(getLocationSuccess, getLocationSecondTry, { timeout: 10000 });
}
// ADVANCED GEO PLUGIN
getLocationSecondTry = function() {
var config = {
"minTime": 500, // Min time interval between updates (ms)
"minDistance": 1, // Min distance between updates (meters)
"noWarn": true, // Native location provider warnings
"providers": "all", // Return GPS, NETWORK and CELL locations
"useCache": true, // Return GPS and NETWORK cached locations
"satelliteData": false, // Return of GPS satellite info
"buffer": false, // Buffer location data
"bufferSize": 0, // Max elements in buffer
"signalStrength": false // Return cell signal strength data
};
AdvancedGeolocation.start(getLocationSuccess, pNearestSites.GetLocationError, config);
// During testing on our devices we found that this plugin would prompt an Andoid permission request for your location, which the official app seems to be lacking atm.
}
```
You will notice that only the first time the official plugin will fail, redirect to the advanced plugin error callback, the permission request will be prompted. From then on the official plugin will work again as normal and the advanced plugin will only be used as a fallback...
So this seems to be doing the job, but I do hope that the official plugin gets fixed fast, so that we don't have to use "ugly" methods like this to fix things...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org