RTC_WAKEUP is not working

前端 未结 4 1093
太阳男子
太阳男子 2021-02-06 17:12

Currently i am working on a Broadcast Receiver application, in which i am making an Alarm which should display a message after we enter the seconds. I used RTC_WAKEUP, which mea

4条回答
  •  走了就别回头了
    2021-02-06 17:40

    RTC_WAKEUP will not switch on the screen, all it does is wakes up thee cpu so that your job is done. For the Screen to be turned on you need a FULL wakelock to be acquired.

    PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
     PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK
                                          | PowerManager.ON_AFTER_RELEASE,
                                          "wakeup");
     wl.acquire();
     // ... do work...
    //show toask
     wl.release();
    

提交回复
热议问题