Hi all,
I created a Service that list all the bluetooth device in area.
The app works well until is in foreground, if I open other app or minimize my app the StartDiscovery return always false.
The service appear to still active because I can see the toast messages and the logs() that appear if the app is minimize also.
Its a limit of Android release or something else?
Many thanks in advance
Paolo
I created a Service that list all the bluetooth device in area.
The app works well until is in foreground, if I open other app or minimize my app the StartDiscovery return always false.
The service appear to still active because I can see the toast messages and the logs() that appear if the app is minimize also.
Its a limit of Android release or something else?
Many thanks in advance
Paolo
B4X:
' **********************************
Sub StartSearchForDevices
If FlgDebug Then Log("StartSearchForDevices")
' Start timeout search timer
StartTmrTimeout
Log(admin.StartDiscovery)
End Sub
Manifest:
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.LightTheme)
'End of default text.
AddPermission(android.permission.BLUETOOTH_SCAN)
AddPermission(android.permission.BLUETOOTH_CONNECT)
AddApplicationText(
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyAFj4o-asLRNr5YnBktyJqZiCP0I5nNVXM"/>
)
SetServiceAttribute(Tracker, android:foregroundServiceType, "location")