Search code examples
androidalarmmanagerandroid-pendingintent

How to make the alarm that sound at phone shutdown time in Android


I had made a reminder that I want it to sound when the phone at shutdown time. I just konw that I set the AlarmManager.RTC_WAKEUP when I executeAlarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent),but I had make a experiment , it not work. Anyone solve it? Thank you!


Solution

  • As Tim Castelijns points out in the comments on the question, AlarmManager has nothing to do with the device shutting down.

    You are certainly welcome to have a BroadcastRecevier registered for ACTION_SHUTDOWN. Since the device is shutting down, you may or may not be able to actually play a sound or otherwise notify the user at this point in time, but you are welcome to try.