Created
March 11, 2013 12:06
-
-
Save oa414/5133796 to your computer and use it in GitHub Desktop.
保持Android设备屏幕常亮
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.AdmobTest; | |
| import android.content.Context; | |
| import android.os.PowerManager; | |
| /** | |
| * Created with IntelliJ IDEA. | |
| * User: linxiangyu | |
| * Date: 13-3-11 | |
| * Time: 下午7:56 | |
| * To change this template use File | Settings | File Templates. | |
| */ | |
| public class WakeUpUtils { | |
| public static void setDeviceWakeUp(Context context){ | |
| /** | |
| * require <uses-permission android:name="android.permission.WAKE_LOCK" /> | |
| */ | |
| PowerManager manager = ((PowerManager)context.getSystemService(context.POWER_SERVICE)); | |
| PowerManager.WakeLock wakeLock = manager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "TAG"); | |
| wakeLock.acquire(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment