Android Question What exctly triggers the "Allow all the time" option for location.

vikingivesterled

Active Member
Licensed User
Longtime User
As opposed to just the option "Allow only while using he app"
I have 2 apps that have the exact same Mainifest and both runs rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION) but on one the user also get asked the "Allow all the time" option while the other one only asks "Allow only while using the app" and no all the time option.
They both use the same libraries of the same version
They both dim Location as LocationManager in the Main module.
They both dim GPS1 As GPS in the Service module.
They both utilize the
lock.PartialLock
Service.StartForeground(nid, CreateNotification("..."))
to keep them running in the background with a "1" on the icon.

With the new Google Play rules and demand for extra documentation this is an impoortant conundrum. I would like to remove the all the time option from some apps because location when app is in foreground is good enough for them and they then don't need special Google validations. While I'd like to add it to another app so it will also record in the background.
 

vikingivesterled

Active Member
Licensed User
Longtime User
Yes:
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="29"/>

I went to the step of copying the whole Manifest from the one that is requsting it to the one that isn't, no difference.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Is the version of android on both devices the same?
 
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
Both apps are being run on the same device, a Samsung Galaxy S10e w/ Android 10 w/ last update from 1'st of November 2020 which is the latest available.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Worse case, you may need to keep minimizing the app until the extra "All the time" option disappears.
 
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
On this particular app I want it to appear. This is an app I upload via the B4A bridge directly to the device. And it is not an option to minimise and install repeatedly to make something happen for an app you want to upload to Google Play.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have 2 apps that have the exact same Mainifest and both runs rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION) but on one the user also get asked the "Allow all the time" option while the other one only asks "Allow only while using the app" and no all the time option.
Make a test and change the package name of both apps. Do they still behave differently?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
Make a test and change the package name of both apps. Do they still behave differently?

The one with the problem continued to have the problem and the one that did ask for permission for background location tracking stopped doing so.

I did uninstall and reinstall the proglem package originally before I noticed the problem.
At the same time I started getting java.io.FileNotFoundException - EACCESS (Permission denied) problems on File.DirRootExternal even though I request and approve PERMISSION_WRITE_EXTERNAL_STORAGE (and read). I got this on the working app as well when I installed it with a different name.

Could this all be part of a bigger problem introduced with Google's new Play Store Policy - App content managment and approval system just gone live in the last few days and with a 30 day time limit to get all approvals sorted.
Could it affect the device and hinder the option on all newly installed apps unless its preapproved through Google Play. Something that is difficult to do since they demand a video of the function which is impossible if you can't make it appear on screen without the same approval. A chicken and egg what came first scenario.


agraham: The explanation on the link is a bit general and it doesn't specify what exactly would trigger the location "Allow all the time" option.
 
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
Added
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
to the Manifest. Made no difference on first startup question but if you then manually go into the app info and select the location permission you do get the option "Allow all the time". However this complicated way of making it work is no good for an app you want to sell on Google Play.

From before I had:
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_LOCATION_EXTRA_COMMANDS)
 
Last edited:
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
I'm doing the
SetServiceAttribute(Tracker, android:foregroundServiceType, "location")
But it still stops recording when app goes into background and starts again when it comes to foreground.

They are journey loggers that use the location to calculate/record the detailed speed and distance and creating a map of where the journey went. Without constant location recording it just stops and create a straight line on the map to where you next open the app.
It uses the GPS1_LocationChanged (Location1 As Location) to trigger the logging to storage.
It only starts that when one press start with the :
lock.PartialLock
Service.StartForeground(nid, CreateNotification("..."))
Which marks the icon with a "1"
and stops it when one press stop.
lock.ReleasePartialLock
Service.StopForeground(nid)
 
Upvote 0

vikingivesterled

Active Member
Licensed User
Longtime User
See the example. It works in the background, no matter which option you select.

That is the sample I've been following since I downloaded it 2 years ago and that worked up until the reinstall this month to get the location permission to reappear for a video for Google Play approval. For the future I'll use manual removal of permissions but its good to check now and then what happens to new users.
I'll check again that I haven't missed anything.
 
Upvote 0
Top