简体   繁体   中英

Android equivalent of iOS' UILocalNotification

I'm looking for the Android equivalent of UILocalNotification (a simple way to schedule a local notification in iOS).

Ideally I would create a local notification and assign it a date and time, and have it fire at that date and time.

In iOS, I create a UILocalNotification and set it's fireDate , and the operating system takes care of firing it at the date and time provided. I don't have to have any background processes running, no timers.

Is there anything like this in Android?

EDIT: I want to be able to "schedule" a notification for a later date. Not one to be fired right away. Even when my app is off or sleeping I would like this to happen. I have read the official documentation on Notifications and have found NOTHING useful, I'm hoping someone who has been through this already can provide an alternative to AlarmManager

After doing some research, I have discovered that the simplicity and convenience of UILocalNotification is not there in Android Notifications . So no, I cannot achieve what I'm trying to achieve through the NotificationManager object alone.

However, I can use AlarmManager for a similar effect, as is mentioned in the following StackOverflow post:

Is it possible to set an Android Notification or a later date and time that will fire when the app is not running?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM