android电源管理小总结
来源:互联网 发布:董云飞老师网络公开课 编辑:程序博客网 时间:2024/04/25 19:34
电源管理-官方提供示例以及文档说明
PowerManager
extends ObjectClass Overview
This class gives you control of the power state of the device.
Device battery life will be significantly affected by the use of this API. Do not acquire PowerManager.WakeLock
s unless you really need them, use the minimum levels possible, and be sure to release them as soon as possible.
You can obtain an instance of this class by calling Context.getSystemService()
.
The primary API you'll use is newWakeLock()
. This will create a PowerManager.WakeLock
object. You can then use methods on the wake lock object to control the power state of the device.
In practice it's quite simple:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); wl.acquire(); ..screen will stay on during this section.. wl.release();
PARTIAL_WAKE_LOCK
On*OffOffSCREEN_DIM_WAKE_LOCK
OnDimOffSCREEN_BRIGHT_WAKE_LOCK
OnBrightOffFULL_WAKE_LOCK
OnBrightBright更多细节官方链接 http://developer.android.com/reference/android/os/PowerManager.html
自己开发应用注意AndroidManifest.xml配置权限,不然会报错
<uses-permission android:name="android.permission.WAKE_LOCK" />
- android电源管理小总结
- Android电源管理
- android电源管理
- Android 的电源管理
- [转] Android电源管理
- [转] android电源管理
- Android WiFi 电源管理
- Android电源管理
- Android 的电源管理
- Android电源管理概念
- Android电源管理
- Android电源管理
- Android 电源管理
- Android的电源管理
- Android 电源管理
- Android 电源管理
- android电源管理
- Android电源管理
- vim快捷键高级用法
- broadcast
- C++ string format的时候出错
- SQL 语句大全
- Android Sandbox(沙箱)开源工具介绍
- android电源管理小总结
- ubuntu解压命令全览
- 二分图的最大匹配问题(匈牙利算法)
- python如何将字符串转换成字典dict类型
- android proguard 使用 (二)
- DirectX 在对话框播放视频
- 临时表
- 学习HTML图像映射
- Java实现FTP上传下载功能