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

Unable to locate my phone if Google location accuracy is disabled #1102

Closed
Outlet2048 opened this issue Oct 14, 2021 · 8 comments
Closed

Unable to locate my phone if Google location accuracy is disabled #1102

Outlet2048 opened this issue Oct 14, 2021 · 8 comments
Assignees
Milestone

Comments

@Outlet2048
Copy link

(this behavior only starts after the app is opened the first time. After a reboot or having crashed in the background for example)

The apps keeps prompting me to enable Google location accuracy when I hit the locate button.
Previously this wasn't necessary since the app will locate me in the background regardless

Recently this behavior has changed and owntracks refuses to find my location + sending it to a server unless location accuracy is enabled. Other apps have no issues finding my location

Enabling it causes owntracks to immediately find me and send said location to server.
It's possible to disable location accuracy after a few hours and not losing the ability to be tracked by the app

Android 11, latest OT beta, oneplus 9 pro

@growse
Copy link
Collaborator

growse commented Oct 21, 2021

This sounds like the behaviour that was introduced in c196ea7 as a result of people disabling location services on their device and then being confused by why OT stopped working. So now it checks to see if location services is enabled when you foreground the app.

I guess there's a potential refinement here, whereby OT only does this check on first start. If the user decides to disable location accuracy (or location alltogether), OT won't try and detect & notify?

@Outlet2048
Copy link
Author

My location services itself are always enabled. The only thing I keep disabled is location accuracy because that would share data with Google.
Therefore, I want to keep this disabled

Currently OT doesn't let you locate yourself after a restart of the app without it being enabled though
In my case owntracks should only prompt me to enable GPS on my phone if it's disabled
Rather than prompting to enable something that technically isn't required to use OT

@growse
Copy link
Collaborator

growse commented Oct 21, 2021

Sure, I understand. The problem is that I don't think it's possible for OT to distinguish between Location off, Location on but location accuracy off, and everything on, using the LocationSettingsRequest.

Maybe an advanced preference called "don't bother me about location apparently being disabled"?

@Outlet2048
Copy link
Author

I'm not a developer at all so I don't know about the inner workings of all that but other maps apps usually just tell you that your GPS is disabled without asking about Google location accuracy
For example when opening magic earth, it'll immediately check if GPS is enabled
But no location accuracy prompt if you have it disabled
It's just telling you to enable GPS in the settings

@growse
Copy link
Collaborator

growse commented Oct 21, 2021

I'll do some investigating. If Magic Earth is open source, I'd be interested to look at what API they're using to detect location enablement that's independent of the location accuracy setting.

My brain is leaky though, so it could well be that there's a very simple Android API that can provide exactly this that I've forgotten about. If so, I think it makes sense to switch to that, because your use case is valid.

edit

O LOOK: https://developer.android.com/reference/androidx/core/location/LocationManagerCompat#isLocationEnabled(android.location.LocationManager)

Right, I'll have a fiddle with that.

@Outlet2048
Copy link
Author

Magic earth is not open source
But organic maps is and their startup detection is exactly the same as magic earth

@growse
Copy link
Collaborator

growse commented Oct 26, 2021

I have this working locally now, so just need to do a bit of refactoring and will try and get another beta out for testing.

@Outlet2048
Copy link
Author

Thanks for your work

@growse growse added this to the v2.4.3 milestone Oct 28, 2021
@growse growse self-assigned this Oct 28, 2021
@growse growse closed this as completed in 1b63f6a Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants