Last active
December 12, 2019 16:28
-
-
Save christocracy/9f43974eb8576e89b686d9781a8d31a5 to your computer and use it in GitHub Desktop.
Posting to Background Geolocation Console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// | |
// How to automatically configure the BackgroundGeolocation plugin to | |
// post to Transistor Software's public Test Server: | |
// | |
// http://tracker.transistorsoft.com/my-organization-name | |
// | |
//// | |
// React Native and Cordova/Ionic | |
// | |
async configureBackgroundGeolocation() { | |
// Fetch a JSON Web Token from dev server. | |
let token = await BackgroundGeolocation.findOrCreateTransistorAuthorizationToken( | |
'my-organization-name', | |
'my-username' | |
); | |
BackgroundGeolocation.ready({ | |
transistorAuthorizationToken: token, // <-- simply provide the token | |
distanceFilter: 10, // <-- your config options as desired | |
stopOnTerminate: false, | |
startOnBoot: false | |
}, (state) => { | |
BackgroundGeolocation.start(); | |
}); | |
} | |
//// | |
// Flutter | |
// | |
void _configureBackgroundGeolocation() async { | |
// Fetch a JSON Web Token from dev server. | |
bg.TransistorAuthorizationToken token = await bg.TransistorAuthorizationToken.findOrCreate( | |
'my-organization-name', | |
'my-username' | |
); | |
bg.BackgroundGeolocation.ready(bg.Config( | |
transistorAuthorizationToken: token, // <-- simply provide the token | |
distanceFilter: 10, // <-- your config options as desired. | |
stopOnTerminate: false, | |
startOnBoot: true | |
)).then((bg.State state) { | |
bg.BackgroundGeolocation.start(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment