Skip to content

Instantly share code, notes, and snippets.

@christocracy
Last active October 11, 2016 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christocracy/516809e81b479f7b0556eb1a9277bcbd to your computer and use it in GitHub Desktop.
Save christocracy/516809e81b479f7b0556eb1a9277bcbd to your computer and use it in GitHub Desktop.
Background Geolocation Scheduler
bgGeo.configure({
startOnBoot: true, // Scheduler will start when device is rebooted.
schedule: [
'2,4 6:00-19:00', // Mon,Wed: 6:00am-7:00pm
'3 11:00-14:00', // Tue: 11:00am-2:00pm
'6 6:00-7:00', // Fri: 6:00am-7:00am
'6 8:00-19:00', // Fri: 8:00am-7:00pm
'2-6 20:00-21:00' // Mon-Fri: 8:00pm-9:00pm
]
}, function() {
// Start the scheduler
bgGeo.startSchedule(function() {
console.info('- Scheduler stopped');
});
});
// Listen to schedule events
bgGeo.on('schedule', function(state) {
console.log('- Schedule event, enabled:', state.enabled);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment