Commit f43aa60d by Sebastián Katzer

Fix handling notifications when application process has been killed #87

parent 78bb3e81
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
<platform name="ios"> <platform name="ios">
<config-file target="config.xml" parent="/*"> <config-file target="config.xml" parent="/*">
<feature name="LocalNotification"> <feature name="LocalNotification">
<param name="ios-package" value="APPLocalNotification"/> <param name="ios-package" value="APPLocalNotification" onload="true" />
<param name="onload" value="true" />
</feature> </feature>
</config-file> </config-file>
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
- (UILocalNotification*) notificationWithProperties:(NSMutableDictionary*)options; - (UILocalNotification*) notificationWithProperties:(NSMutableDictionary*)options;
// Ruft die JS-Callbacks auf, nachdem eine Notification eingegangen ist // Ruft die JS-Callbacks auf, nachdem eine Notification eingegangen ist
- (void) didReceiveLocalNotification:(NSNotification*)localNotification; - (void) didReceiveLocalNotification:(NSNotification*)localNotification;
// Ruft die JS-Callbacks auf, nachdem eine Notification eingegangen ist
- (void) didFinishLaunchingWithOptions:(NSNotification*)notification;
// Hilfsmethode gibt an, ob er String NULL oder Empty ist // Hilfsmethode gibt an, ob er String NULL oder Empty ist
- (BOOL) strIsNullOrEmpty:(NSString*)str; - (BOOL) strIsNullOrEmpty:(NSString*)str;
// Fires the given event // Fires the given event
...@@ -301,11 +303,29 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; ...@@ -301,11 +303,29 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
} }
/** /**
* Ruft die JS-Callbacks auf, nachdem eine Notification eingegangen ist.
*/
- (void) didFinishLaunchingWithOptions:(NSNotification*)notification
{
NSDictionary* launchOptions = [notification userInfo];
UILocalNotification *localNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotification)
{
[self didReceiveLocalNotification:notification];
}
}
/**
* Registriert den Observer für LocalNotification Events. * Registriert den Observer für LocalNotification Events.
*/ */
- (void) pluginInitialize - (void) pluginInitialize
{ {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:)
name:CDVLocalNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishLaunchingWithOptions:)
name:UIApplicationDidFinishLaunchingNotification object:nil];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment