Android Question Service.StopAutomaticForeground in ver.12

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.

I have a question - I'm testing my app in ver.12 and found a very strange situation.

In Starter in sub Sub Service_Start (StartingIntent As Intent) I have a line
B4X:
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.

It works fine in ver.11.80 and if I'm using FLP for GPS coordinates it receives Lat/Long, then disconnects from the service and stops as I expected.

But in ver.12 the same code doesn't work properly - it looks like Service.StopAutomaticForeground doesn't do anything - no crash, no errors. FLP receives lat/long, disconnected from the service and continues to receive coordinates.

Am I doing something wrong?

Please see the attached example - it works fine in 11.80 but not in 12.

Thank you.
 

Attachments

  • TestFLP.zip
    9.9 KB · Views: 207

Alex_197

Well-Known Member
Licensed User
Longtime User
Nothing has changed in v12 related to this behavior. I guess that you also changed the targetSdkVersion but it has nothing to do with v12.
Here is my manifest
B4X:
'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: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.

'    FusedLocationProvider:

'    required manifest entry required for Google Play Services
AddApplicationText(<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />)
    
'    you must add one of these two permissions
'    the permission you add will define the accuracy of location updates
AddPermission(android.permission.ACCESS_FINE_LOCATION)
    AddPermission(android.permission.ACCESS_COARSE_LOCATION)
 
Upvote 0
Top