Hi, I am making an Alarm app. When the alarm time comes, I show the user a dialog. But the problem is that I want to get a lock after a dialog box appears. just like when just received sms, the screen just wakes up.
I tried this one but it doesn't work
public class Alarm extends Activity{ PowerManager pm; WakeLock wl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); pm = (PowerManager) getSystemService(POWER_SERVICE); wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "FlashActivity"); wl.acquire() showAlarmDialog(); } @Override protected void onPause() {
I also added permission to wakelock. Help will be announced :-)
Usman iaz
source share