2015-05-06 82 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(); 
}