Last active
May 24, 2024 15:28
-
-
Save christocracy/516809e81b479f7b0556eb1a9277bcbd to your computer and use it in GitHub Desktop.
Background Geolocation Scheduler
This file contains hidden or 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
// Listen to schedule events | |
BackgroundGeolocation.onSchedule((state) => { | |
console.log('- Schedule event, enabled:', state.enabled); | |
}); | |
BackgroundGeolocation.ready({ | |
startOnBoot: true, // Scheduler will start when device is rebooted. | |
stopOnTerminate: false, // Continue after app-terminate. | |
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 | |
] | |
}, (state) => { | |
// Start the scheduler | |
BackgroundGeolocation.startSchedule(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment