When my app is on background and I receive a remote notification, two things can happen:
I tap on the push notification banner, my apps comes to foreground and didReceiveRemoteNotification is called.
I tap on my app icon from the springboard, my app comes to foreground and didReceiveRemoteNotification IS NOT called.
So, in the scenario 1, I can update my counter of unread messages inside the app in response to didReceiveRemoteNotification. In the scenario 2, I can't.
How can I solve this using Quickblox?
Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.
The definition of push notification They can appear on a lock screen or in the top section of a mobile device. An app publisher can only send a push notification if the user has their app installed. If you have installed the app and have enabled push notifications, they can be sent by the app publisher at any time.
Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notification summary.
As one possible variant:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo) {
[self handleRemoteNotifications:userInfo];
}
// Override point for customization after application launch.
return YES;
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[self handleRemoteNotifications:userInfo];
}
#pragma mark - Remote notifications handling
-(void)handleRemoteNotifications:(NSDictionary *)userInfo {
// do your stuff
}
@end
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