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 app stops updating location when app loses focus #61

Closed
khers opened this issue Dec 3, 2019 · 8 comments
Closed

Android app stops updating location when app loses focus #61

khers opened this issue Dec 3, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@khers
Copy link

khers commented Dec 3, 2019

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.

@bilde2910
Copy link
Owner

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?

@khers
Copy link
Author

khers commented Dec 3, 2019

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?

@bilde2910
Copy link
Owner

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.

@bilde2910 bilde2910 added the bug Something isn't working label Dec 3, 2019
@khers
Copy link
Author

khers commented Dec 4, 2019

If you can walk me through getting the logs, I would be happy to post them.

@bilde2910
Copy link
Owner

Reproduced on Pixel 3 XL with Android Q in a VM. Will try to figure out why this happens and look for a fix.

@khers
Copy link
Author

khers commented Dec 5, 2019

Thanks for the fast turn around!

@bilde2910
Copy link
Owner

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.

@khers
Copy link
Author

khers commented Dec 10, 2019

Working for me now, thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants