コード例 #1
0
 public boolean disconnect(BluetoothDevice device) {
   if (mService == null) return false;
   // Downgrade priority as user is disconnecting the headset.
   if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) {
     mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
   }
   return mService.disconnect(device);
 }
コード例 #2
0
 public void setPreferred(BluetoothDevice device, boolean preferred) {
   if (mService == null) return;
   if (preferred) {
     if (mService.getPriority(device) < BluetoothProfile.PRIORITY_ON) {
       mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
     }
   } else {
     mService.setPriority(device, BluetoothProfile.PRIORITY_OFF);
   }
 }
コード例 #3
0
 public int getPreferred(BluetoothDevice device) {
   if (mService == null) return BluetoothProfile.PRIORITY_OFF;
   return mService.getPriority(device);
 }
コード例 #4
0
 public boolean isPreferred(BluetoothDevice device) {
   if (mService == null) return false;
   return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF;
 }