Android WakeLock

来源:互联网 发布:上虞用友软件 编辑:程序博客网 时间:2024/05/24 05:42

A wake lock is a mechanism to indicate that your application needs to have the device stay on.

唤醒锁是一种能表明你的程序让设备保持唤醒状态的机制


Any application using a WakeLock must request the android.permission.WAKE_LOCK permission in an <uses-permission> element of the application's manifest. Obtain a wake lock by calling newWakeLock(int, String).

Call acquire() to acquire the wake lock and force the device to stay on at the level that was requested when the wake lock was created.

Call release() when you are done and don't need the lock anymore. It is very important to do this as soon as possible to avoid running down the device's battery excessively.

采用单例模式))))



0 0
原创粉丝点击