Monday, June 27, 2016

Push Notification

“Push Notifications? Ohh, no!”

As an iOS developer, you know that iOS supports two types of notifications: Local and Push (or Remote).
Push notifications on the other hand are not scheduled by the app. They are triggered by another service (called provider), most often a web server, and they’re usually targeting to multiple devices simultaneously. With push notifications, app creators can send messages to users when necessary, either in random times or scheduled, and either with a customized (personalised) or a default message body.
Every single push notification that is sent from a provider to one or more target devices, follows a mandatory path. That is through the Apple Push Notification Servers, or simply APN servers. Those servers actually route push notifications to the proper devices, and messages are normally delivered within a few seconds by the time they’re sent by the provider. In simple words, the lifecycle of a remote notification can be summed up as shown next:
Provider >> APN servers >> Target Devices
I encourage you to pay a visit to the official documentation for useful details about the way push notifications work.
Important notice:
Before we get into the details of this tutorial’s concept, I must make clear that I make some assumptions about some certain conditions that should be met. So, I take as granted that:
  1. You have a paid Developer account, or you have at least access to such an account.
  2. You have at least one existing iOS Development Certificate in the Apple Developer Member Center portal. In the opposite case, take a look here. If you need to use a Code Signing Request (CSR) file, read the next part on how to generate it.
  3. You acknowledge that when saying “push notifications” in this text I refer to “Apple Push Notifications” only.
  4. You acknowledge that when saying “Apple Developer website” I mean the “Apple Developer Member Center portal”.
  5. You already have some knowledge what the payload of a notification is (content, badge, sound, any additional data), and what you can do with it. To refresh your memory about notifications take a look here.
Step 1: The Certificate Signing Request
open the Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority… menu, as shown next:

In the window that comes up, you need to mandatorily fill in the User Email Address and Common Name fields. Besides that, click to the Saved to disk option so you are able to save the CSR file to disk, and use it later in the Apple Developer website.

Continue and save it for future progress of developement.

Step 2: Create an App ID

Go to Member Center and Select Certificates, Identifiers & Profiles.

Now Select Certificates. And Click on App IDs.

Create New App ID :

As you are creating AppId Just scroll down and select Push Notification from App Services.


Then Just Click Next and Click Submit.
Select App Id From App ID List.

Step 3: Configure the App ID for Push Notifications

Now you can see Push Notification Configurable for specific app Id.

Command To Make PEM File :

cd
cd Desktop
openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts
Share:

0 comments:

Post a Comment