I have tried many libraries to get location but this library is best for me to track location continuously in background on android.
But I has a problem when I start but can’t stop to track location when app is paused or closed to save the battery life when app need to run a long time in background, I use accelerometer sensor to detect motion. If the phone has no motion then I will stop background location tracker and restart when the motion is detected.
I want to use another background service to detect motion from sensor and control to start/stop background location tracker in order to turn on/off GPS sensor and save battery life. The library works perfectly when the app is activated but don’t work properly when the app come to be paused and closed.
I have already tried many ways but couldn’t be successful. I hope to get any help !
I have tried many libraries to get location but this library is best for me to track location continuously in background on android. But I has a problem when I start but can’t stop to track location when app is paused or closed to save the battery life when app need to run a long time in background, I use accelerometer sensor to detect motion. If the phone has no motion then I will stop background location tracker and restart when the motion is detected. I want to use another background service to detect motion from sensor and control to start/stop background location tracker in order to turn on/off GPS sensor and save battery life. The library works perfectly when the app is activated but don’t work properly when the app come to be paused and closed. I have already tried many ways but couldn’t be successful. I hope to get any help !
Here is my minimal source code to demonstrate my issue. https://github.com/truongtana13/motion_gps.git