Created
August 8, 2013 08:21
-
-
Save mikrobi/6182683 to your computer and use it in GitHub Desktop.
Use `CDVInvokedUrlCommand ` as parameter to make the `setApplicationIconBadgeNumber` method callable from JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command; { | |
DLog(@"setApplicationIconBadgeNumber:%@\n", command.arguments); | |
self.callbackId = command.callbackId; | |
NSMutableDictionary* options = [command.arguments objectAtIndex:0]; | |
int badge = [[options objectForKey:@"badge"] intValue] ?: 0; | |
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge]; | |
[self successWithMessage:[NSString stringWithFormat:@"app badge count set to %d", badge]]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment