@@ -109,6 +109,13 @@ HsStablePtr global_didFailToRegisterForRemoteNotificationsWithError = 0;
109109 callWithCString([deviceTokenString UTF8String], global_didRegisterForRemoteNotificationsWithDeviceToken);
110110}
111111
112+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
113+ // Sent when the application receives remote notifications in the foreground or background
114+ // TODO Allow a configurable CString -> IO () to be passed into AppDelegateConfig
115+ [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] valueForKey:@"badge"] intValue];
116+ completionHandler(UIBackgroundFetchResultNewData);
117+}
118+
112119- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
113120 // Sent to the delegate when Apple Push Notification service cannot successfully complete the registration process.
114121 NSString *errorString = [error localizedDescription];