2015-05-06 83 views
1

藍博使用了很長時間,無法使用。當我禁用藍牙時,經過一段時間後,它會自動打開。 錯誤打印的信息:android無法禁用藍牙

05-05 06:28:25.814: E/BTIF_CORE(5554): btif_disable_bluetooth : not yet enabled 
05-05 06:28:33.819: E/BluetoothAdapterState(5554): Error disabling Bluetooth 
05-05 06:28:33.855: E/PRX(628): hard code service registered. 
05-05 06:28:33.874: E/BluetoothServiceJni(5554): SOCK FLAG = 1 *********************** 
05-05 06:28:33.874: E/(5554): [email protected]:[JSR82][JBT] JSR82 does not init 
05-05 06:28:33.874: E/BluetoothServiceJni(5554): Socket listen failed: 1 
05-05 06:28:33.874: E/BluetoothAdapterService(1112665360)(5554): Failed to create socket channel 
05-05 06:28:33.874: E/[MAP]BluetoothMapService(5554): [initSocket] Error create RfcommServerSocket java.io.IOException: Error: -1 
05-05 06:28:33.922: E/BluetoothServiceJni(5554): SOCK FLAG = 1 *********************** 
05-05 06:28:33.922: E/(5554): [email protected]:[JSR82][JBT] JSR82 does not init 
05-05 06:28:33.922: E/BluetoothServiceJni(5554): Socket listen failed: 1 
05-05 06:28:33.923: E/BluetoothAdapterService(1112665360)(5554): Failed to create socket channel 
05-05 06:28:33.923: E/BluetoothPbapService(5554): Error create RfcommServerSocket java.io.IOException: Error: -1 
05-05 06:28:33.982: E/BluetoothReceiver(1042): [MMI][BluetoothReceiver.startService][start service [com.mediatek.bluetooth.AdvancedService] 
05-05 06:28:33.994: E/BluetoothServiceJni(5554): SOCK FLAG = 0 *********************** 
05-05 06:28:33.994: E/(5554): [email protected]:[JSR82][JBT] JSR82 does not init 
+0

你是否在你製作的應用程序中關閉了藍牙?如果是這樣,請發佈代碼,如果你的問題發生在你的設備上,而不管應用程序是什麼,那麼這個問題是不是編程相關 – TomTsagk

+0

@Dengshun Yin:請張貼您的代碼。 –

+0

不要在我的應用程序中打開。但是這個問題是應用程序在一段時間後運行。藍牙繼續在應用程序中重新啓動。 –

回答

0
BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); 
BluetoothAdapter to = bluetoothManager.getAdapter(); 
isServiceRestart = true; 
if(to.isEnabled()) { 
    to.disable(); 
    try { 
     Thread.sleep(2000); 
    } catch (InterruptedException e) { 
     e.printStackTrace(); 
    } 
    to.enable(); 
} else if(!to.isEnabled()) { 
    to.enable(); 
}