how to wakeup android phone from sleep?

前端 未结 3 1272
情深已故
情深已故 2021-02-20 14:16

How to wakeup android phone from sleep (suspend to mem) programmably? I don\'t want to acquire any wakelock, which means the phone goes into \"real\" sleep with the cpu disabled

3条回答
  •  面向向阳花
    2021-02-20 15:10

    Use AlarmManager to broadcast an Intent at the time you want to do some work and have the device wake up. In the BroadcastReceiver, either do the work you need to do (if it is short), or obtain a WakeLock (probably via a singleton), start a service, have the service do the work, then have the service release the WakeLock.

    You can read about that here: https://groups.google.com/forum/#!topic/android-developers/5--QRAPlFL0

提交回复
热议问题