Skip to content

Instantly share code, notes, and snippets.

@ednilsonamaral
Last active May 15, 2019 21:19
Show Gist options
  • Select an option

  • Save ednilsonamaral/da01b5479d9a10b66581f1cf6fcfd665 to your computer and use it in GitHub Desktop.

Select an option

Save ednilsonamaral/da01b5479d9a10b66581f1cf6fcfd665 to your computer and use it in GitHub Desktop.
this.platform.ready().then(() => {
// Ativando backgroundMode
cordova.plugins.backgroundMode.enable();
// BackgroundMode em segundo plano
cordova.plugins.backgroundMode.on('activate', () => {
this.backgroundMode.disableWebViewOptimizations();
setInterval(() => {
// Iniciando leitura da Position do usuario enquanto estiver em backgroundMode
this.locationTrackerProvider.startTracking();
}, 60000);
});
// BackgroundMode quando o app estiver fechado
cordova.plugins.backgroundMode.on('deactivate', () => {
setInterval(() => {
// Iniciando leitura da Position do usuario enquanto estiver em backgroundMode
this.locationTrackerProvider.startTracking();
}, 60000);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment