Register for Local Notification

a 夏天 提交于 2019-12-20 03:16:57

问题


I am developing an IOS application with phonegap and need to set local notification for it which will repeat on every friday and specified time

Also there is requirement that user will decide to receive or not the local notification


回答1:


I recommend you read the following article on the topic which i found very helpful

http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html

- (void)scheduleNotification {

    [[UIApplication sharedApplication] cancelAllLocalNotifications];

        UILocalNotification *notif = [[UILocalNotification alloc] init];
        notif.fireDate = [datePicker date];
        notif.timeZone = [NSTimeZone defaultTimeZone];

        notif.alertBody = @"Body";
        notif.alertAction = @"AlertButtonCaption";
        notif.soundName = UILocalNotificationDefaultSoundName;
        notif.applicationIconBadgeNumber = 1;

       [[UIApplication sharedApplication] scheduleLocalNotification:notif];
        [notif release];
    }
}

This is just a basic outline of how it works but starting from this you should be able to schedule a notification.



来源:https://stackoverflow.com/questions/9529590/register-for-local-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!