how to wake lock using powermanager class in android -
Hi, I am trying to wake up the lock for a particular amount but I can not find the result, I have a power manager class But I'm not getting any results I'm using to lock this code
PowerManager.WakeLock wl; PowerManager pm = (PowerManager) getSystemService (event.pOWER_SERVICE); Wl = pm.newWakeLock (PowerManager.PARTIAL_WAKE_LOCK, "My tag"); Button B = (button) Find VVBIID (R.B. button 1); B.setOnClickListener (New OnClickListener () {@Override Click Public Zero (see ARG0) {wl.acquire (); wl.release ();}}); } Here I am trying to invite lock when I click on the button but it is not working to stop me using special broad receiver Please thank me first
You should 1. First hold a wakelock; 2. Do something else; 3. Release the wakelock.
So you should test it:
button b1 = (button) findViewById (R.id.button1); B1.setOnClickListener (New OnClickListener () {@Override Click Public Zero (see ARG0) {wl.acquire ();}}); Button B2 = (button) Find VVBIID (R.B. button2); B2.setOnClickListener (New OnClickListener () {@Override Public Zero Click on (see ARG0) {wl.release ();}}); Press the press button Lock the screen for a test Press the button 2 What's more: < / P>
- PARTIAL_WAKE_LOCK: Ensures that the CPU is running; Screen and keyboard
- FULL_WAKE_LOCK (I think you want): This ensures that the screen and keyboard backlight are full brightness.
Comments
Post a Comment