Hai i developed a application using broadcast receiver.I need to wake my Application always.so i used wakelock.here my code
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();
problem
1.If i wake up always my battery is getting drained.
2.if i cal w1.acquier()
,Is necessary to release the w1(ie w1.release)
I don't understand what is your 1st question.. I thought that is a fact if you want to keep waking up your application?
If keep your screen not dimming down is what you want to achieve, you could try this code:
//This is to keep the screen not dimming down.
Window.AddFlags(WindowManagerFlags.KeepScreenOn);