Mention a few of the push-related concepts before implementing a message push, such as:
1, Provider: is to specify the iOS device application to provide push server, (if the iOS device application is the client, then Provider can be understood as the service side [initiator of the message]);
2, Apns:apple push Notification service[Apple message Push server];
3, the IPhone: used to receive APNS issued by the news;
4, the client App:ios the application on the device, is used to receive the iphone transmits APNs the message to the development one client app[message final responder];
Can be divided into three stages:
Phase one: provider[service side] to send the message, the purpose of the iOS device identification packaging, sent to APNs;
Stage Two: APNs in the list of iOS devices for which you have registered the push service, look for an iOS device with the appropriate identity and send the message to the iOS device;
Phase three: The iOS device passes the message sent to the corresponding application and pops up the push notification as set.
Specific processes, such as:
1, [Client APP] Registration message push;
2, [client app] and [APNS Service] to Devicetoken, client app receive Devicetoken;
3, [Client App] Send devicetoken to [Provider]push server program;
4, when the push server program satisfies the sending message condition, [Provider] sends the message to [APNS service];
5. [APNS Service] sends the message to the [Client App].
Second, the message push implementation:
1. Generate the *.certsigningrequest file with the following steps:
[macbookà application à utility à keychain access to a certificate assistant a certificate from a certificate authority? * Certificate information (user e-mail address {Fill in your mailbox, such as: [email protected]}, common name {arbitrary, such as: Pushdemo}, the request is: {radio, Select ' Save to disk '} to continue à save], the file you specified will be generated in the place you specified, The default is Certificatesigningrequest.certsigningrequest file, named here: Pushdemo.certsigningrequest. This *.certsigningrequest has been generated , the procedure is shown in the following two images.
If the build succeeds, the key associated with the *.certsigningrequest is listed in the Keychain access | login | Key column, which is Pushdemo, as shown in:
2. Create a new app ID (configured in the Apple developer account)
(1) Log in to iOS Dev Center and after successful login, click on the (iOS Provisioning portal corresponding link) as shown in:
(2) Create new app Id[app idsàmanageànew app id] (description{fill in your description of this app ID, such as: Ishop},bundle Seed ID (App ID Prefix) {Select Bind app ID prefix, such as: Default selection Generate New},bundle Identifier (app ID Suffix) {Fill in the binding App ID suffix, such as: Com.yourcorp.iShop}) as shown:
This will generate the following record, as shown in:
(3) Configure the app ID generated in the previous step to support message push [click Configureà in 2-6 to select Enable for Apple Push Notification serviceà Click Configure] as shown in:
(4) Generate a Certificate Signing request (Generate deployment request authentication) [Click 2configureàcontinueà in step 1 to generate the *certsigningrequest file (here is ishop. Certsigningrequest) Àgenerateà The build is complete and download it, named: Aps_developer_identity.cer], double-click Aps_developer_identity.cer Certificate { Associate the certificate with the key and import the certificate into the MacBook} as shown in:
(5) Create development Provisioning profiles[Development License profile] (provisioning| Development| New profile), as shown in the following procedure:
Click on submit to generate development Provisioning profiles[Development License Profile], here is: Ishopdevprofile.mobileprovision as shown:
Download this development license (for online debugging).
Summary, so far we have generated: A:*.certsigningrequest file (used in step (4), used to generate certificate B), B:aps_developer_identity.cer certificate (on Provider[push server] Service-side application), c:*. Mobileprovision Development License Profile (used in the client app app for online debugging).
Now that the message-push configuration is complete, the next step is to write the Provider[push server] service-side application and client app application program.
Third, the realization of provider service end
Here is simply a brief account of the provider server (Java implementation) steps as follows:
(1) *.P12 files required to make the provider server:
In the above implementation of the (4) part of the figure shown in the key, certificate, we did not use it, then why to show it, guess why? To make a *.p12 file? Haha, you guessed right, we use it to make *.P12 file, step: ([macbookà application à utility à keychain access [keychain: Login, kind: Certificate]à Select the certificate you just generated (Apple development IOS services:** à menu à file à export project ... à[stored as: arbitrary file name (e.g. Ipush), format: Default (Personal Information exchange (. p12))]à Enter password for export [password: Any, verify: with password the same]à input MacBook login password à allow à final generation.
Key steps such as: