react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Start headless task (or JS listeners) on device boot

Open iocuydi opened this issue 5 years ago • 4 comments
trafficstars

Hi, I'm wondering if it's possible to start a headless/non-headless JS task listener on device boot. Starting the background service on device boot doesn't seem to help much since I can't act on the results of it. In particular, I'm recording boundary updates via react native async storage, and sending exact position to firebase. The background service starts after device boot, but doesn't retain any of the previously declared listeners. How can I recreate these on boot? Thanks!

Your Environment

  • Plugin version:
  • Platform: Android
  • OS version: 10
  • Device manufacturer and model: Google Pixel
  • Running in Simulator: No
  • React Native version: 0.60

iocuydi avatar Mar 18 '20 02:03 iocuydi

This actually make sense. Worth implementing it.

mauron85 avatar Mar 24 '20 06:03 mauron85

My current (less than ideal) workaround is to just start the app in background on device boot, perform some checks to see if it's in a state that should be tracking location, and if so, start the background service. I can help with this on GitHelp

iocuydi avatar Mar 24 '20 19:03 iocuydi

Dear @iocuydi and Dear @mauron85 i called registerHeadlessTask and i started it in java code but it's not useful. Because we should launch the app after reboot to load JS bundle and register our headless task from JS code !

ehsan-askari avatar Apr 28 '20 20:04 ehsan-askari

+1

lyseiha avatar Jul 30 '20 09:07 lyseiha