android接收到藍(lán)牙配對(duì)請(qǐng)求時(shí)如何點(diǎn)亮屏幕具體實(shí)現(xiàn)
更新時(shí)間:2013年06月17日 15:31:54 作者:
android 在接收到藍(lán)牙配對(duì)請(qǐng)求時(shí)如何自動(dòng)點(diǎn)亮屏幕配對(duì)過程中很實(shí)用,具體的實(shí)現(xiàn)思路及代碼如下,感興趣的朋友可以參考下哈
file: BluetoothEventLoop.java
GB/GB2/GB3:
1. import android.os.PowerManager;
2. 變量申明:private PowerManager.WakeLock mWakeLock;
3. BluetoothEventLoop(){} 構(gòu)造函數(shù)里面添加定義:
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, TAG);
mWakeLock.setReferenceCounted(false);
4. onRequestPairingConsent(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
5. onRequestPasskeyConfirmation(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
6. onRequestPasskey(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
7. onRequestPinCode(){
...
mWakeLock.acquire(5000); // xintong 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
8. onDisplayPasskey(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
ICS/ICS2/JB/JB2/JB3:
省略掉GB中修改的第1、2、3步;
對(duì)4、5、6、7、8中修改的function中:將原生的mWakeLock.acquire(); 改為mWakeLock.acquire(5000), 刪掉對(duì)應(yīng)function中的mWakeLock.release();
修改完后,模塊會(huì)被編譯進(jìn)framework.jar
GB/GB2/GB3:
1. import android.os.PowerManager;
2. 變量申明:private PowerManager.WakeLock mWakeLock;
3. BluetoothEventLoop(){} 構(gòu)造函數(shù)里面添加定義:
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, TAG);
mWakeLock.setReferenceCounted(false);
4. onRequestPairingConsent(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
5. onRequestPasskeyConfirmation(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
6. onRequestPasskey(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
7. onRequestPinCode(){
...
mWakeLock.acquire(5000); // xintong 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
8. onDisplayPasskey(){
...
mWakeLock.acquire(5000); // xintong , 亮屏5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
ICS/ICS2/JB/JB2/JB3:
省略掉GB中修改的第1、2、3步;
對(duì)4、5、6、7、8中修改的function中:將原生的mWakeLock.acquire(); 改為mWakeLock.acquire(5000), 刪掉對(duì)應(yīng)function中的mWakeLock.release();
修改完后,模塊會(huì)被編譯進(jìn)framework.jar
相關(guān)文章
Android仿iOS側(cè)滑退出當(dāng)前界面功能
這篇文章主要為大家詳細(xì)介紹了Android仿iOS側(cè)滑退出當(dāng)前界面功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12Android實(shí)現(xiàn)為Notification加上一個(gè)進(jìn)度條的方法
這篇文章主要介紹了Android實(shí)現(xiàn)為Notification加上一個(gè)進(jìn)度條的方法,結(jié)合實(shí)例形式分析了Android針對(duì)Notification組件的相關(guān)操作技巧,需要的朋友可以參考下2016-10-10Android中隱藏狀態(tài)欄和標(biāo)題欄的方法匯總(隱藏狀態(tài)欄、標(biāo)題欄的五種方法)
這篇文章主要介紹了Android中隱藏狀態(tài)欄和標(biāo)題欄的方法匯總(隱藏狀態(tài)欄、標(biāo)題欄的五種方法),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02Android?妙用TextView實(shí)現(xiàn)左邊文字,右邊圖片
這篇文章主要介紹了Android?妙用TextView實(shí)現(xiàn)左邊文字,右邊圖片的相關(guān)資料,需要的朋友可以參考下2023-07-07android實(shí)現(xiàn)Splash閃屏效果示例
這篇文章主要介紹了android實(shí)現(xiàn)Splash閃屏效果的方法,涉及Android中postDelayed方法及AndroidManifest.xml權(quán)限控制的相關(guān)使用技巧,需要的朋友可以參考下2016-08-08Android Location服務(wù)之LocationManager案例詳解
這篇文章主要介紹了Android Location服務(wù)之LocationManager案例詳解,本篇文章通過簡(jiǎn)要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-08-08完美解決Android三星手機(jī)從圖庫選擇照片旋轉(zhuǎn)問題
這篇文章主要幫助大家完美解決了Android三星手機(jī)從圖庫選擇照片旋轉(zhuǎn)問題,很實(shí)用的解決小案例,感興趣的小伙伴們可以參考一下2016-04-04