breautek commented on issue #210:
URL:
https://github.com/apache/cordova-plugin-geolocation/issues/210#issuecomment-748350592
> it only shows the option to allow get location while use, instead of
always, is there a way to get this permission to always,
I'm not sure how you are accessing geolocation from the background as this
plugin doesn't really support this due to limitations.
On Android, we don't have a geolocation implemented, we just use the browser
implementation. The plugin is purely to manage permissions. This is problematic
for background usage as apps in the background has no activity and the webview
cannot exists outside of an Activity. For iOS, the webview is completely paused
while the app is in the background. So it cannot receive GPS events during in
the background.
If you need background support, a third-party plugin will be required that
sets up the proper background services and provides the ability to send updates
to the webview when the webview is capable of handling those updates (ie when
it comes into the foreground).
> Also, when I am using watchposition I get an empty array and cant access
the coords,
This plugin doesn't pass arrays for coordinates. It passes an object with
the following properties:
```javascript
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude +
'\n' +
'Longitude: ' + position.coords.longitude +
'\n' +
'Altitude: ' + position.coords.altitude +
'\n' +
'Accuracy: ' + position.coords.accuracy +
'\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy +
'\n' +
'Heading: ' + position.coords.heading +
'\n' +
'Speed: ' + position.coords.speed +
'\n' +
'Timestamp: ' + position.timestamp +
'\n');
};
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]