Correct initialization
Opened this issue · 3 comments
Hi There,
Thanks for this very usefull plugin!
I have a question about initialization, on instruction there is:
//Make sure to get at least one GPS coordinate in the foreground before starting background services
navigator.geolocation.getCurrentPosition(function() {
console.log("Succesfully retreived our GPS position, we can now start our background tracker.");
}, function(error) {
console.error(error);
});
....
So is correct to initialize the plugin with:
bgLocationServices.start();
On the first location success? Ie:
navigator.geolocation.getCurrentPosition(function() {
//omitting initialization parameters...
bgLocationServices.start();
}, function(error) {
console.error(error);
});
Somethimes switching background foreground lead to a strange problem, the coordinates seems to "fix" to a point and then this point i recalled many times...
Thanks
Rob
@oudoken
Yes you must receive a geolocation point in the foreground before hopping in the background. If the foreground geolocation request doesn't come back before you go into the background it may cause problems, however I haven't ever had a problem with that specifically. I would recommend attempting to get a geolocation coordinate in the foreground right when the app starts up to be sure.
Is probably not configuring the plugin
`bgLocationServices.configure({
//Both android and ios
desiredAccuracy: 10, //Precisión deseada de las actualizaciones de ubicación (menor significa más exacta pero más consumo de batería)
distanceFilter: 0, //(Medidores) Hasta qué punto debe moverse desde el último punto para activar una actualización de ubicación
debug: true, // <--Habilitar para mostrar las indicaciones visuales cuando recibe una actualización de la ubicación de fondo
interval: 300000, //(Milisegundos) Intervalo solicitado entre actualizaciones de ubicación.
useActivityDetection: false, // Utiliza la detección de Actividad para apagar los gps cuando todavía está (mejora enormemente la duración de la batería)
//Android Only
notificationTitle: 'ABpro Systems', // title of the notification
notificationText: 'Geolocalizacion', //text of the notification
fastestInterval: 300000 // <--(Milisegundos) Intervalo más rápido que su aplicación o servidor puede manejar actualizaciones
});
`