2012-06-01 3 views
0

화면 터치 이벤트를 캡처하는 프로그램을 작성합니다. 하지만 화면이 꺼지면 MotionEvent ev을 얻을 수 없습니다.Android에서 화면이 꺼져있을 때 화면 터치 이벤트를 캡처하는 방법은 무엇입니까?

private PowerManager pm = null; 
private PowerManager.WakeLock wl = null; 
this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE); 
this.wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "test"); 
wl.acquire(); 

@Override 
public boolean dispatchTouchEvent (MotionEvent ev) { 
    if(ev.getAction() == MotionEvent.ACTION_DOWN) 
     Log.i("test", "!!!"); 
    return true; 
} 

답변

-1

당신은 당신의 목표를 달성하기 위해 Intent.ACTION_SCREEN_ON 및 Intent.ACTION_SCREEN_OFF를 사용할 수 있습니다. this link 도움을받을 수 있습니다.

관련 문제