手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android接收到蓝牙配对请求时如何点亮屏幕具体实现
android接收到蓝牙配对请求时如何点亮屏幕具体实现
摘要:file:BluetoothEventLoop.javaGB/GB2/GB3:1.importandroid.os.PowerManager...

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接收到蓝牙配对请求时如何点亮屏幕具体实现】相关文章:

Android系列之Intent传递对象的几种实例方法

Android 新手入门体验

Android中 动态改变对话框值的方法

android如何默认打开小区广播具体实现

android USB如何修改VID具体实现

Android SlidingDrawer 抽屉效果的实现

Android中查看服务是否开启的工具类

Android画图并保存图片的具体实现代码

android 对话框弹出位置和透明度的设置具体实现方法

Android图片翻转动画简易实现代码

精品推荐
分类导航