How to detect Bluetooth state change using a broadcast receiver?

前端 未结 3 1538
逝去的感伤
逝去的感伤 2020-12-02 18:59

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,

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 19:24

    You have to take following permission.

    
    

    and you have to write this as your intent filter in receiver tag.

    
    

提交回复
热议问题