Lollipop Lollipop - 1 year ago 53
Android Question

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

when I execute
AlarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent)
,but I had make a experiment , it not work.
Anyone solve it? Thank you!

Answer Source

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.