Android休眠设置时间

来源:互联网 发布:2017淘宝卖家用什么app 编辑:程序博客网 时间:2024/05/01 16:16

转自  http://m.blog.csdn.net/blog/song_shi_chao/23365243



/**
* 获得休眠时间 毫秒
*/
private int getScreenOffTime() {
int screenOffTime = 0;
try {
screenOffTime = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT);
} catch (Exception localException) {

}
return screenOffTime;
}

/**
* 设置休眠时间 毫秒
*/
private void setScreenOffTime(int paramInt) {
try {
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT,
paramInt);
} catch (Exception localException) {
localException.printStackTrace();
}
}




// get auto lock time after timeout

long lockTime = Settings.Secure.getLong(getContentResolver(), "lock_screen_lock_after_timeout", 5000);



参考链接:
http://androidforums.com/lg-esteem/431924-how-extend-screen-lock-timeout.html
https://questforever.atlassian.net/secure/attachment/13808/settings.txt
http://stackoverflow.com/questions/19820534/automatically-lock-time(解决问题的答案)
http://blog.csdn.net/zzp16/article/details/7888052#


0 0
原创粉丝点击