SoFunction
Updated on 2025-03-03

How to light up the screen when Android receives Bluetooth pairing request

file:
GB/GB2/GB3:
1. import ;
2. Variable declaration: private mWakeLock;
3. Add definitions to the BluetoothEventLoop(){} constructor:
PowerManager pm = (PowerManager)(Context.POWER_SERVICE);
mWakeLock = (PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, TAG);
(false);
4. onRequestPairingConsent(){
...
(5000); // xintong, 5s on the screen
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
5. onRequestPasskeyConfirmation(){
...
(5000); // xintong, 5s on the screen
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
6. onRequestPasskey(){
...
(5000); // xintong, 5s on the screen
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
7. onRequestPinCode(){
...
(5000); // xintong 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
8. onDisplayPasskey(){
...
(5000); // xintong, 5s on the screen
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
ICS/ICS2/JB/JB2/JB3:
Omit steps 1, 2, and 3 of the modification in GB;
In the function modified in 4, 5, 6, 7, 8: Change the native(); to (5000), and delete the () in the corresponding function;
After modification, the module will be compiled into