I'm diving into iOS development and have been working on an alarm clock app to become familiar with iOS platform and SDK. I'm using Local Notifications to handle my alarms, but I need some method of managing the Local Notifications I set so that they can be updated if I edit or remove any of the alarms associated with them. I figured out how I can unschedule a Local Notification using cancelLocalNotification:
function after it's been scheduled, but I'm having a hard time figuring out how to retrieve the Local Notification object associated with the alarm that was edited or removed so that I can use that function. I should note that all of my alarm objects that are used to create the Local Notifications are being stored in a Core Data DB and their interface is defined as...
@interface Alarm : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * Snooze;
@property (nonatomic, retain) NSNumber * AlarmID;
@property (nonatomic, retain) NSString * Label;
@property (nonatomic, retain) NSDate * Repeat;
@property (nonatomic, retain) NSDate * Time;
@property (nonatomic, retain) NSNumber * Enabled;
@property (nonatomic, retain) NSString * Song;
@property (nonatomic, retain) NSString * Sound;
@end
Thanks so much in advance for your help!
Local notifications are scheduled by an app and delivered on the same device. They are suited for apps with time-based behaviors, such as calendar events. When you run your app on a device with Android OS 8.0 or above, Kony uses default channels that are mentioned in the localnotificationconfig.
As you are already aware, you can schedule maximum of 64 notifications per app. If you add more than that, the system will keep the soonest firing 64 notifications and will discard the other.
Scheduled Summary (also known as Notification Summary) allows users to bundle non-urgent alerts from apps (that don't require immediate attention) and receive them in summary at convenient times. It is helpful if you have a busy routine and free time only at lunch, during evening subway rides, and at night.
With local notifications, your app configures the notification details locally and passes those details to the system, which then handles the delivery of the notification when your app is not in the foreground. Local notifications are supported on iOS, tvOS, and watchOS.
To answer question #2 use scheduledLocalNotifications
, which will get back to you NSArray of all notifications scheduled for your app.
To answer question #3 use userInfo
property of UILocalNotification
class. It's a dictionary and you can save anything you want there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With