Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android : Radar doesn't track the gps location after some time when the app is open in background (with a foreground service) #19

Open
Cachwir opened this issue Apr 19, 2021 · 3 comments

Comments

@Cachwir
Copy link

Cachwir commented Apr 19, 2021

Describe the bug

When I let the app open on Android with a foreground service, and with continuous tracking, for about 24 hours, and then check the User's locations panel on Radar.io, I see they stop working after a few hours on my phone (Huawei on Android 6) and when the app is on friend A's phone (Asus on Android 9), the foreground service doesn't even work so the recordings happen only when the app is in pure foreground. No problem noticed on friend B's phone (Samsung on Android 10).
For the foreground service, I use the following plugin : https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/

I noticed another bug while doing my tests : when entering a place with no internet signal, staying for about an hour, leaving and going back outside, with my data back on, and waited for about 2 hours, I noticed that even though the foreground was still running, Radar had stopped sending my position to the server even though it got a working data again.

How to reproduce

  1. Install https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/ and configure it to start a foreground service and starting the gps tracking with cordova.plugins.radar.startTrackingContinuous();
  2. Build and start the app, agree to be tracked when the app is on (the "always track" choice is not there)
  3. Try to put the app in background. You'll get asked for permission to keep the app as a foreground service. Accept and put it again in background.
  4. Put the app in background, confirm there is a notification to notice you of the foreground service
  5. Check on Radar.io that your location is indeed updated
  6. Wait for maximum 24 hours
  7. Go back to the Radar.io panel and check that the user's gps location has not been updated after a certain time
  8. Check on the phone and confirm the foreground service is still running

Expected Behaviour

The user's gps location should be updated on Radar.io at anytime, as long as the foreground service is running.

Metadata

Cordova version 10.0.0
cordova-android version 9
Platform : Android
Device : Huawei Honor with Emui 4.0 (Android 6.0.1)

@Cachwir Cachwir changed the title Android : Radar doesn't track the gps location after some time when the app is open in background (with foreground service) Android : Radar doesn't track the gps location after some time when the app is open in background (with a foreground service) Apr 19, 2021
@jsani-radar
Copy link

Hey Cachwir, sorry to hear about this problem that you're experiencing.

I'm not familiar with that plugin, so unfortunately I can't comment on issues that might be arising from using that with the Radar library. It sounds like the foreground service is still running but the location updates stopped, so it's possible that the process and subsequent location requests got killed by the OS due to the failures.

With continuous mode, you shouldn't have to use an additional plugin, so long as you've started a foreground service to start tracking locations.

@Cachwir
Copy link
Author

Cachwir commented Apr 26, 2021

Actually, that plugin's sole purpose is to configure and start a foreground service.
Also, I have been using the continuous mode and the location update still got killed.
I'm truly out of options there...

@jsani-radar
Copy link

I am not familiar with that plugin so I can't comment on its behavior.

Android has been quite tight around monitoring vitals, so my hunch is that the native OS is detecting too much activity and killing the process. Plugin usage and behavior need to abide by the limits of the native OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants