2012-10-09 87 views

回答

1

注册BroadcastReceiver以收听BluetoothDevice.ACTION_BOND_STATE_CHANGED

里面一个BroadcastReciever:

public void onReceive(Context context, Intent intent) 
{ 
    if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(intent.getAction())) 
    { 

    int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, -1); 

     if (bondState == BluetoothDevice.BOND_BONDED) 
     { 
       // wake up 
     }   

    } 
} 
+0

谢谢你,它的工作:) – Milly

+0

欢迎您... –

+0

请问如果手机处于睡眠状态(屏幕关闭,没有激活锁定)这项工作? – stackoverflowuser2010