Push Notification helps you in sending event or alert to your app users even when they are not logged into app. App42 uses APNS (Apple Push Notification Service) to send Push Notification on iOS devices.
To configure Push Notifications for iOS Apps/Games, the prerequisites are :
Once you have all, you need to generate AppID and SSL certificate on iOS Developer portal, .p12 file and a provisioning profile configured for push notification. This guide will walk you through all the necessary steps needed to configure your app for push notification.
To manually generate the certificate, Certificate Signing Request (CSR) file is needed from your MAC that will be used to authenticate the creation of SSL certificate.
To create CSR file, please follow the steps mentioned below:
To install an application on your device, you need to create an App ID and you do this on iOS Dev Center .
Now we will generate SSL certificate that is needed to make a secure connection between the App42 Push Server and APNS. This certificate will be linked to the App ID you just created so that the App42 Server will send push notifications to this particular app only.
Now you have a valid certificate for sending push notification in development environment, If you need this for Production environment, repeat the same process for the Production.
a. Keep your .cer file and .p12 file in a single folder
b. Open terminal and go to the folder that has both the files $ cd “your folder path”
c. Now execute the following commands in the terminal :
openssl x509 -in aps_development.cer -inform DER -out developer_identity.pem -outform PEM openssl pkcs12 -nocerts -in App42PushDevKey.p12 -out App42PushDevKey.pem openssl pkcs12 -export -inkey App42PushDevKey.pem -in developer_identity.pem -out iphone_dev.p12
Where, aps_development.cer <= SSL Certificate you downloaded from Apple in Step 3 and App42PushDevKey.p12 <= The .p12 file you just created above.
Go to iOS Dev Center and select Certificates, Identifiers & Profiles . Select Provisioning Profile option from the sidebar and select + button.
Now you have to follow a 4-step Add iOS Provisioning Profile wizard
Step-1 : Select Type
Select iOS App Development under Development and then click Continue.
Step-2 : Configure
Select the App ID you created earlier in section-2 of this tutorial for me it is “App42PushApp” and click Continue.
Step-2.1 Select Certificates :
Select the certificates from the list provided to include in this provisional profile and click Continue.
Step-2.2 Select Devices :
Select the devices you wish to include in this provisioning profile and click Continue.
Step-3 : Generate
Enter a meaningful name for this provisioning profile in field Profile Name.This will be used to identify the profile in the portal. Now click Generate.
Step-4 : Download
Select Download to download the generated profile. Add the profile to Xcode by double clicking on it and You are done.
Note:- Repeat the process to generate the Ad Hoc / App Store profile, the only difference is, select the Select Type as Ad Hoc / App Store instead of Development in the Step-1.
To send Push Notification using App42 Cloud API, you have to upload the iphone_dev.p12 file, that you created in step-4, to AppHQ Console.
Repeat the same process to configure App42 Cloud API App for Push when it is ready for distribution, except selecting production environment from Environment option from the drop down menu.
Note:- Environment drop-down menu has two options development and production. You can upload two .p12 files one for each environment. But we recommend to have only one active push profile at a time.