Finder
Finder

Reputation: 8711

Push notification in ios - Badging and Banner showing different request

I have enabled the push notification in my product.currently it shows the badging. Now I want to implement the another notification in the same product but different response. I mean,

One request send the response for the badge notification second request send the response the banner notification. Is it possible to do it ios?

Please guide me. I can do it only one at time. But How can I do it both ?

THanks in advance

Upvotes: 1

Views: 308

Answers (1)

Eran
Eran

Reputation: 393831

I'm not entirely sure what you'd like to do. If you want to send a single push notification that contains both badge and alert, simply put both badge and alert in your JSON payload :

{

    "aps" : {

        "alert" : "You got your emails.",

        "badge" : 9

    }

}

You have to register for both types of notifications in your app :

- (void)applicationDidFinishLaunching:(UIApplication *)app {

   // other setup tasks here....

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)];

}

Now when you send a push notification, the badge number will be modified and the alert will be displayed.

Upvotes: 1

Related Questions