2012-10-24 25 views

回答

-1

試試這個

//add permission to AndroidManifest.xml 

<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission> 

WakeLock wl;//in class 

//in onCreate method initiate them 
PowerManager pm=(PowerManager)getSystemService(POWER_SERVICE); 
wl=pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "anything"); 

//in onResume() method get lock 
wl.acquire(); 

//in onPause() method release lock 
wl.release(); 
+0

沒有,即使你把一個激活鎖定,它不解鎖屏幕。 –

+0

他說他的應用程序在啓動後運行,他不能讓wakelock和防止鎖定屏幕? – sampathpremarathna

+0

@sampathpremarathna不管喚醒鎖,屏幕在啓動時自動鎖定。 – Eric

相關問題