2012-03-05 148 views
1

我的问题是,手机的睡眠模式的API是什么,如果手机在几分钟内不使用,它会进入睡眠模式吗?那么Android开发的编程部分是什么?Android上的睡眠模式

回答

2

看看PowerManager及其内部类PowerManager.WakeLock。 例如,为了防止睡眠一些代码

PowerManager pm = (PowerManager) SJPhone.getContext().getSystemService(Context.POWER_SERVICE); 
PowerManager.WakeLock wl = pm.newWakeLock(flags,WAKE_LOCK_STR); 
wl.acquire(); 

// you code goes here 

wl.release(); 
wl = null; 
+0

那是完美的,非常感谢队友把它包 – 2012-03-05 19:02:27