file: BluetoothEventLoop.java
GB/GB2/GB3:
1. import android.os.PowerManager;
2. 變量申明:private PowerManager.WakeLock mWakeLock;
3. BluetoothEventLoop(){} 構造函數里面添加定義:
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步;
對4、5、6、7、8中修改的function中:將原生的mWakeLock.acquire(); 改為mWakeLock.acquire(5000), 刪掉對應function中的mWakeLock.release();
修改完后,模塊會被編譯進framework.jar
android接收到藍牙配對請求時如何點亮屏幕具體實現
2021-01-30 15:00Android開發網 Android
android 在接收到藍牙配對請求時如何自動點亮屏幕配對過程中很實用,具體的實現思路及代碼如下,感興趣的朋友可以參考下哈
延伸 · 閱讀
- 2022-03-11Android String類型轉換為float、double和int的工具類方
- 2022-03-11Android 8.1 Launcher3實現動態指針時鐘功能
- 2022-03-11Android控件Spinner實現下拉列表及監聽功能
- 2022-03-11詳解Android獲取所有依賴庫的幾種方式
- 2022-03-11Android 仿高德地圖可拉伸的BottomSheet的示例代碼
- 2022-03-11Android 優化之卡頓優化的實現
- Android
Android控件系列之CheckBox使用介紹
CheckBox和Button一樣,也是一種古老的控件,它的優點在于,不用用戶去填寫具體的信息,只需輕輕點擊,缺點在于只有“是”和“否”兩種情況,但我們往...
- Android
Android Animation實戰之屏幕底部彈出PopupWindow
這篇文章主要為大家介紹了Android Animation動畫實戰項目,屏幕底部彈出PopupWindow,如何實現?文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的...
- Android
淺談Android系統的基本體系結構與內存管理優化
這篇文章主要介紹了Android系統的基本體系結構與內存管理優化,非常簡潔明了地總結了系統服務及垃圾回收等安卓的一些主要特性,需要的朋友可以參考下...
- Android
解析Android應用程序運行機制
這篇文章主要介紹了Android應用程序運行機制,有需要的朋友可以參考一下...
- Android
Android開發筆記之:對實踐TDD的一些建議說明
本篇文章是對Android中實踐TDD的一些建議進行了詳細的分析介紹,需要的朋友參考下...
- Android
使用RadioButton+Fragment實現底部導航欄效果
這篇文章主要為大家詳細介紹了使用RadioButton+Fragment實現底部導航欄效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下...
- Android
Android中掃描多媒體文件操作詳解
這篇文章主要介紹了Android中掃描多媒體文件操作詳解,本文講解了Android中的多媒體文件掃描機制、如何掃描一個剛創建的文件、如何掃描多個文件,需要的朋...
- Android
Android編程中EditText限制文字輸入的方法
這篇文章主要介紹了Android編程中EditText限制文字輸入的方法,涉及Android針對EditText的監聽技巧,具有一定參考借鑒價值,需要的朋友可以參考下...