-
Notifications
You must be signed in to change notification settings - Fork 63
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 app stops updating location when app loses focus #61
Comments
That's strange. What Android version are you running? And can you check that you don't have any battery savings, battery optimizations or data savings settings enabled that might prevent the app from running in the background? |
Android 10 with the Nov 5, 2019 security update applied. Google Play system update 2019-10-01. I am sure that it battery optimization is disabled for Hauk. I noticed that under permissions that it says Hauk is only allowed to access my location while I am using the app (and I don't see a way to make it always okay), could that cause this? |
I don't have a physical device with Android 10 on it yet. My OnePlus 6 is scheduled to receive the update soon, but until the update actually lands, I can only test in a VM. I'll launch a Pixel VM with Android 10, start a share, and see what happens when I let it stay in the background for a little while. Due to a small technicality in Android, apps are considered to be "in use" or in the foreground when they're running a so-called foreground service. Hauk uses this to ensure it isn't killed by the system. Some manufacturers' custom ROMs have battery saving settings that are overly aggressive and shut down apps' foreground services anyway (e.g. OnePlus, Xiaomi and Huawei have this). But it would be strange if this was the cause on Pixel, which uses a near-stock ROM. And since you said battery optimizations are disabled, I don't see it being this. I'll try to run it in an Android 10 VM, but I can't promise any particular results. I might have to ask you for log data if I fail to figure it out. |
If you can walk me through getting the logs, I would be happy to post them. |
Reproduced on Pixel 3 XL with Android Q in a VM. Will try to figure out why this happens and look for a fix. |
Thanks for the fast turn around! |
That was a surprisingly easy fix. Apparently Android Q has a new feature that considers foreground services to be in the background unless the service specifically requests foreground location updates. This will be live in v1.5.1. |
Working for me now, thanks! |
I don't know if this is intentional, but I am seeing the android app stop updating my location a few minutes after it loses focus and then it never starts up again. If I want to update my location I have to kill the app and resume a session.
This is on a Pixel 3XL with the latest updates installed.
The text was updated successfully, but these errors were encountered: