2015-04-17 52 views

回答

0

事情是這樣的:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();  
if (mBluetoothAdaper != null) { 
    mBluetoothAdapter.enable(); 
} 

不要忘記權限:

android.permission.BLUETOOTH 
android.permission.BLUETOOTH_ADMIN 

編輯:如果你只是不希望出現的消息,只是刪除:

Toast.maketext(context, "Bluetooth turned on", Toast.LENGHT.SHORT).show();

在你的代碼

地方。

+0

用戶已經提到,他知道如何使用它的代碼,以使,他想知道如何禁用當藍牙被激活時顯示Toast通知。 –

+0

當bluethooth從代碼中運行時,此代碼將不會通知用戶「Bluethoth正在運行」? @Strider –

+0

@Rajen Raiyarela你是對的,你有什麼想法我如何能實現我的目標,如果你知道,請幫我 –

相關問題