Push IOS 10

Source: Internet
Author: User

1:APNs notifications vs. in-app messages

The Aurora document is written like this.

Later, it is more straightforward to say:

2: Here's how to accept notification calls under different States of the app:

IOS support, this is the program in the foreground to receive notification is the appropriate method

-(void) Jpushnotificationcenter: (unusernotificationcenter *) Center willpresentnotification: (unnotification *) Notification Withcompletionhandler: (void (^) (Nsinteger)) Completionhandler {

Required

Nsdictionary * UserInfo = notification.request.content.userInfo;

if ([Notification.request.trigger Iskindofclass:[unpushnotificationtrigger class]]) {

[Jpushservice Handleremotenotification:userinfo];

}

If the receptionist received the notification, you can also set reminders, specific needs to ask the product

Completionhandler (Unnotificationpresentationoptionnone); Need to implement this method, choose whether to remind the user, there are badge, sound, alert three types can choose to set

}

Foreground notifications can be set through the enumeration above

IOS support programs run in the background Click Push Notifications will go this way

-(void) Jpushnotificationcenter: (unusernotificationcenter *) Center Didreceivenotificationresponse: ( Unnotificationresponse *) Response Withcompletionhandler: (void (^) ()) Completionhandler {

Required

Nsdictionary * UserInfo = response.notification.request.content.userInfo;

if ([Response.notification.request.trigger Iskindofclass:[unpushnotificationtrigger class]]) {

[Jpushservice Handleremotenotification:userinfo];

}

NSLog (@ "%@", response.notification.request.content.body);

Completionhandler (); The system requires this method to be executed

}

Program has been killed

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {

[bugly startwithappid:@ "49c45f90fe"];

Remote push sent over JSON string

Nsdictionary *userinfo = Launchoptions[uiapplicationlaunchoptionsremotenotificationkey];

The content of the notification exists in Launchoptions

Nsdictionary *userinfo = Launchoptions[uiapplicationlaunchoptionsremotenotificationkey];

userinfo[@ "APS"][@ "alert"]

Inside you can get the content of the notification

//Silent Notification ( silent notification when the app is dead )

Silent push: Receive push (no text no sound), without the need to open the notification, without opening the app, you can execute

The key to using silent notifications is that the program is able to hit the code behind the scenes without clicking on the notification (which should be the silent notification itself without the notification bar).

Regardless of which three-way push is used (Aurora, Melt Cloud, Push, Pushmebaby), be sure to set

Be sure to add "content-available": 1 (only set this field, you can implement background push to complete the reception)

And also

Sound,alert badge also can not add, added words are also silent push, can be tested when added

Instance Silent push content

Because the key point of silent push is the background of the push loose, so be sure to remember to open the app background push function

If you upgraded the IOS10, be sure to follow the latest documentation for integration

Note :

1: should be provided

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {  // Required, iOS 7 Support  [JPUSHService handleRemoteNotification:userInfo];  completionHandler(UIBackgroundFetchResultNewData);}- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {  // Required,For systems with less than or equal to iOS6  [JPUSHService handleRemoteNotification:userInfo];}

 下面的方法会被上面的方法挤掉

If you want to receive a silent notification, you must implement the above method instead of the following

That is, silently using the iOS 7 method to replace the original

2: About the certificate: If your company's background integrated Aurora Push, should provide a good push of the two certificate of the P12 file

Production certificates are not necessarily on-line

3: Method of judging the procedure in the foreground

[UIApplication sharedapplication].applicationstate = = uiapplicationstateactive

4: Aurora push does not show little red dot

Application.applicationiconbadgenumber = 0;

[Jpushservice setbadge:0]; (Server to Aurora)

Additional information on the notification:

1: Method of receiving foreground notification call

2: Notification of added click events, by Notification settings classification

Click on the different buttons above to invoke the following method, which is distinguished by identifier

3:

4. Inheriting the company's own push requires only

Appdelegate inside set AppID can

5: The background of the silent notification, should be the flow of judgment

Push IOS 10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.