Android Question Intent not acquired

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all! I updated my sdk and set the target version on 28, but in Android 8 i have an intent that is not acquired. I need to know when a bluetooth device is connected or disconnetted with my device.
I used ACTION_CONNECTION_STATE_CHANGED o bluetooth adapter and works in others android versions.

This is the manifest:
B4X:
AddReceiverText(SendNotification,
<intent-filter>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED"/>
<action android:name="android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED"/>
</intent-filter>)

AddPermission(android.permission.BLUETOOTH)
AddPermission(android.permission.BLUETOOTH_ADMIN)

In SendNotification service i write a log with the action, but CONNECTION_STATE_CHANGE will never called
B4X:
Service_Start (StartingIntent As Intent)
    Log(StartingIntent.Action)
STATE_CHANGED works correctly

Any advice? Thanks!
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The list of valid implicit broadcasted actions is available here: https://developer.android.com/guide/components/broadcast-exceptions
All other implicit actions will not work on Android 8+ (with static filters).

Expected to work: android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED

Will not work: android.bluetooth.adapter.action.STATE_CHANGED
 
Upvote 0
Top