Here is an update that more accurately describes what I am seeing:
1. When the app runs in the foreground, or when the app runs in the background, or even when the app is force-quit by the user, the my location is regularly updated with a silent notification appearing like this (my lat/lon hidden for privacy, but yes I'm in Melbourne
):
2. When the device is rebooted (Motorola G51 with Android 12), the following silent notification appears within about 30 seconds:
3. After 50 minutes had elapsed, the GPS coordinates were still not displayed. so the notification looks like this:
I am now thinking that the RunAtStart:True is running fine, but the GPS itself is not refreshing. Even after leaving it for several hours, the location still did not appear.
Three more observations:
- As soon as I tap the silent notification, the activity opens and the position is displayed within a few seconds
- The code I am using is the example as provided - no changes
- I am doing all this in an area with very good GPS satellite coverage
Does this sound like an issue with this particular device? If so I could grab another device/brand.
Does this sound like an issue with my Android version? If so I could get an Android 13 device.
Is there any workaround I could try to ensure that the GPS starts at boot?
My B4A version is 12.80
My manifest is:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
SetServiceAttribute(Tracker, android:foregroundServiceType, "location")