In my application, I have added push notification service, It' all working fine. It's require to handle notifications when App is not in active or background mode.
I added code for that as below. In method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound];
NSDictionary *RemoteNoti =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (RemoteNoti) {
//your methods to process notification
}
return YES;
}
eg., I got three notification When app is not running in background or foreground and I tap on notification it gives me detail of tapped notification only.
It's giving tapped notification detail only is correct behavior? OR there should all three notification's detail of NSDictionary *RemoteNoti =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
Please suggest If I am missing anything for that.
Yes it is correct behavior. You will be get only one notification that selected by you.
In dictionary containing the payload of the remote notification. > - alert: Either a string for the alert message or a dictionary with two keys: body and show-view. > - badge: A number indicating the quantity of data items to download from the provider. This number is to be displayed on the app icon. The absence of a badge property indicates that any number currently badging the icon should be removed. > - sound: The name of a sound file in the app bundle to play as an alert sound. If “default” is specified, the default sound should be played.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With