开发者

Auto enable bluetooth on android phone [duplicate]

开发者 https://www.devze.com 2023-03-18 16:02 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to enable/disable bluetooth programmatically in android
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to enable/disable bluetooth programmatically in android

I'm trying to write an App that will turn Bluetooth on to scan for devices and connect to a specific device, if it is in range. My problem is how do I turn the Bluetooth on if it is off? If I use :

if (!mBluetoothAdapter.isEnabled()) {
    Intent enableBtIntent = new Intent(Bluetooth开发者_开发百科Adapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}

there is still a question for the user if he wants to turn the Bluetooth on. Can I turn if on programmatically without the users involvement?


There is no possibility to turn on some phone features like BT, GPS, WiFi without user action. It's android feature introduced in 1.6(?) due to security concerns.

0

精彩评论

暂无评论...
验证码 换一张
取 消