Android Question LocationChanged Event doesn't fire. (FusedLocationProvider)

HappyDad

Member
Licensed User
I made a small program to check the location periodically, and then do something according to the location.
The program was doing fine in last 10 days.
But today, it stopped working.
I found that the ConnectionSuccess event did fire. But it never went to the LocationChanged event.
In the main activity I asked for permission of fine location, but in the service, for FusedLocationProvider, I only want balanced power accuracy.
B4X:
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)

LocationRequest1.SetPriority(LocationRequest1.Priority.PRIORITY_BALANCED_POWER_ACCURACY)

However, when I use another GPS app,
the LocationChanged event will fire immediately when that app gets a fix.

I don't know what's wrong.
 

HappyDad

Member
Licensed User
First step is to restart the phone. Might be an OS issue.

What is the battery level? Maybe it is too low for this setting.
Yeah, I already restarted the phone, just did it again, doesn't help.
Battery level is high, 78%.
It should be something related to the OS.
Need some time to figure out.
 
Upvote 0

JohnC

Expert
Licensed User
Try turning off battery optimization for your particular app.

Maybe the OS running your app suddenly decided that your app was using too much battery and "flagged" it for optimization, so that's why it suddenly stopped working normally.
 
Upvote 0
Top