I am trying to make an app that shows a toast when the device\'s Bluetooth turned on. I wanna do that even when my app is not running. So I should use a broadcast receiver,
Unfortunately, for apps targeting api 26 or higher, manifest declared broadcast receivers don't work anymore (reference here: https://developer.android.com/guide/components/broadcast-exceptions), with some exceptions.
android.bluetooth.adapter.action.STATE_CHANGED
is not in that list.
For bluetooth, you can only listen for changes on:
ACTION_CONNECTION_STATE_CHANGED
, ACTION_ACL_CONNECTED
, ACTION_ACL_DISCONNECTED