Push Notification Action - View Button

I have a working program that sends my push notifications without any problems. After clicking the โ€œViewโ€ button, the Push application is open, but a blank screen is displayed without content.

How can I make it work that after clicking the โ€œViewโ€ button I will see โ€œContentโ€ in the application?

My idea (for example): I get a push notification with the following content: today you get a 30% discount in our store

After clicking "View" I will enter the application and can read the full message with all the content. I mean working as a blog. Push Notification is a preliminary article, and the View button is a Details tag. And in my application, I have several articles that I can read. Same as here: http://www.myfitapp.de/fitnessstudio-app/push-nachrichten/

Is it possible? And How?

0
source share
2 answers

Yes, of course, it is possible. But you cannot send large amounts of content using push notifications. V Push notification can contain no more than 256 bytes.

, userInfo , . , , , .

,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


   NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
   if (remoteNotif) {
      ///Handle the notification
   } 

   /* Your regular init  */

   return YES; 
}

, :

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
  ///Handle the notification
}

NSDictionary , .

-

Userinfo push- - JSON, .

{
    "aps" : {
        "alert" : "You got your emails.",
        "badge" : 9,
        "sound" : "bingbong.aiff"
    },
    "acme1" : "bar",
    "acme2" : 42
}

Apple, aps JSON , 9 " ". . bingbong.aiff, .

amce1 amce2 , , push-.

+3

, . :   

 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 

userInfo , : blog_id , "" "".

0

All Articles