How to check if bluetooth is enabled programmatically?

后端 未结 6 1114
小蘑菇
小蘑菇 2020-12-13 23:46

I would like to check if bluetooth is enabled on any Android device periodically. Is there any intents that I could catch using BroadcastReceiver to do so, or is there other

6条回答
  •  无人及你
    2020-12-14 00:06

    Here I have other alternative as an answer for this question.

    First add following lines in your Manifest file.

    
    

    Now, where you want to check Bluetooth supportability, use following code.

    boolean isBluetoothSupported = getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
    

提交回复
热议问题