#PhoneGap 3.x Local Notifications
Supported Platforms:
- Android
- iOS
##Setup - iOS
-
In
CordovaLib/Classes/CDVPlugin.muncomment the following line ininitWithWebView[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil]; -
In
CordovaLib/Classes/CDVPlugin.muncomment the following block at the end of the file- (void)didReceiveLocalNotification:(NSNotification *)notification {} -
In
CordovaLib/Classes/CDVPlugin.huncomment the following line- (void)didReceiveLocalNotification:(NSNotification *)notification; -
In
Classes/AppDelegate.madd the following to thedidFinishLaunchingWithOptions:delegateUILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (notification) { [[self.viewController settings] setValue:notification forKey:@"LaunchOptionsLocalNotificationKey"]; } -
In
Classes/MainViewController.madd the following to thewebViewDidFinishLoad:delegateUILocalNotification *notification = [[self settings] objectForKey:@"LaunchOptionsLocalNotificationKey"]; if(notification) { [[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification]; }