PowerManager pm = (PowerManager) m_sInstance.getSystemService(Context.POWER_SERVICE);
fullWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "GangstarGreeActivity");
keepScreenOn(true);
public static boolean keepScreenOn(boolean keep)
{
if (keep && !fullWakeLock.isHeld())
{
if (fullWakeLock != null)
{
fullWakeLock.acquire();
return true;
}
}
else if (!keep && fullWakeLock.isHeld())
{
if (fullWakeLock != null)
{
fullWakeLock.release();
return true;
}
}
return false;
}
{
if (keep && !fullWakeLock.isHeld())
{
if (fullWakeLock != null)
{
fullWakeLock.acquire();
return true;
}
}
else if (!keep && fullWakeLock.isHeld())
{
if (fullWakeLock != null)
{
fullWakeLock.release();
return true;
}
}
return false;
}
댓글 없음:
댓글 쓰기