H HappyDad Member Licensed User Longtime User Mar 23, 2020 #1 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: Copy 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.
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: Copy 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.
Erel B4X founder Staff member Licensed User Longtime User Mar 23, 2020 #2 Try this example: https://www.b4x.com/android/forum/threads/fusedlocationprovider.50614/post-717726 Upvote 0
H HappyDad Member Licensed User Longtime User Mar 23, 2020 #3 Erel said: Try this example: https://www.b4x.com/android/forum/threads/fusedlocationprovider.50614/post-717726 Click to expand... That example also doesn't work when I set the 'Priority' to PRIORITY_BALANCED_POWER_ACCURACY. I tried my program on another phone, and my program works on that phone. Now I don't know what has changed on my first phone. Upvote 0
Erel said: Try this example: https://www.b4x.com/android/forum/threads/fusedlocationprovider.50614/post-717726 Click to expand... That example also doesn't work when I set the 'Priority' to PRIORITY_BALANCED_POWER_ACCURACY. I tried my program on another phone, and my program works on that phone. Now I don't know what has changed on my first phone.
Erel B4X founder Staff member Licensed User Longtime User Mar 23, 2020 #4 Does it work if you don't change anything? Upvote 0
H HappyDad Member Licensed User Longtime User Mar 23, 2020 #5 Erel said: Does it work if you don't change anything? Click to expand... Yes, it works if I don't change anything. My program also works if I set priority to PRIORITY_HIGH_ACCURACY. Upvote 0
Erel said: Does it work if you don't change anything? Click to expand... Yes, it works if I don't change anything. My program also works if I set priority to PRIORITY_HIGH_ACCURACY.
Erel B4X founder Staff member Licensed User Longtime User Mar 23, 2020 #6 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. Upvote 0
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.
H HappyDad Member Licensed User Longtime User Mar 23, 2020 #7 Erel said: 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. Click to expand... 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
Erel said: 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. Click to expand... 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.
JohnC Expert Licensed User Longtime User Mar 23, 2020 #8 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
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.