Java tutorial
//package com.java2s; import android.content.Context; import android.os.PowerManager; public class Main { public static PowerManager.WakeLock wakeLock = null; public static void acquireWakeLock(Context context) { if (wakeLock == null) { PowerManager powerManager = (PowerManager) (context.getSystemService(Context.POWER_SERVICE)); wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); wakeLock.acquire(); } } }