正如标题所说, 我需要获得关于屏幕状态的信息。
我认为斯坦比是正确的状态 我的意思是, 这就是当你按下电源按钮 屏幕完全关闭的时候。
但如何检测到呢?
提前交纳你的帮助。
索维特:
I managed to solve the problem i was having: the code was right, but the thread was stopping executing when in stanby mode; that s because i was having the wrong feeling that the code was wrong. Solved simply by using a wake lock, that ensure the cpu will be active even when in stanby mode:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
wl.acquire();
..CPU will stay on during this section..
wl.release();