Skip to Content
Author's profile photo SIMMACO FERRIERO

How to use Push Notifications with iOS and Android Hybrid applications – part 2

Introduction

This is the continuation of the blog started here. You only need this part if you are going to develop and test push notification for iOS devices. If you are not interested in this part you can simply skip it an go to the last part of this article.I’ve decided to write this blog to show clearly how you can enable your mobile devices, iOS or Android, to leverage the capabilities of Push Notifications provided by the HCPms.

This blog has been split in 3 parts:

Link Content
How to use Push Notifications with iOS and Android Hybrid applications – part 1 Step 1 – Enable push notifications for Android
This part Step 2 – Enable push notifications for iOS
How to use Push Notifications with iOS and Android Hybrid applications – part 3 Steps 3 -> 6 – Create an app on HCPms, then another in SAP Web IDE, deploy the app to mobile services and test the app with some push notifications

Step 2 – Enable push notifications for iOS

For iOS is a little bit more complicated because instead of having just a server API key and a sender ID, you need to request a certificate and upload it to HCPms.

NOTE: For this step a MAC is required, you CANNOT perform these steps on a Windows machine.

1 – Open Keychain

2 – Click on Keychain Access –> Certificate Assistant –> Request a Certificate From a Certificate Authority…

/wp-content/uploads/2016/05/08_959739.png

3 – Enter your email, select Saved to disk and click on Continue

4 – The certificate (CertificateSigningRequest.certSigningRequest) will be saved somewhere on your disk

5 – Click on Done

6 – Go to Apple Developer portal  https://developer.apple.com/ and click on Account

/wp-content/uploads/2016/05/06_959740.png

7 – Enter your credentials

8 – Select your team if needed

9 – Click on Certificates, Identifiers & Profiles

/wp-content/uploads/2016/05/07bis_959759.png

10 – Click on on Identifiers –> App Ids

/wp-content/uploads/2016/05/10_959760.png

11 – Click on the “+” sign in order to create a new App ID

12 – Enter a name for your application (i.e. “Acme Push Notifications”) and choose the right App ID Prefix.

/wp-content/uploads/2016/05/12_959762.png

13 – Normally you can use the App ID Prefix related to your Team ID. You can get it by looking in the Membership Information in Xcode

/wp-content/uploads/2016/05/13_959763.png

14 – In the App Services section, enable Push Notifications and click on Continue

/wp-content/uploads/2016/05/14_959764.png

15 – Push Notifications are now Configurable. Just click on Register

16 – Click on Done

17 – Search for the application ID that you have just created, select it and click on Edit

/wp-content/uploads/2016/05/17_959765.png

18 – Select Push Notifications and choose Create Certificate in the Development SSL section. We are just using our application for testing.

/wp-content/uploads/2016/05/18_959766.png

19 – A new window opens. Click on Continue

20 – Click on Choose File to upload your CSR certificate we have generated some steps ago.

/wp-content/uploads/2016/05/20_959767.png

21 – Select the certificate and click on Choose

22 – Click on Continue

/wp-content/uploads/2016/05/22_959768.png

23 – Your certificate is ready. Click on Download to download it somewhere on your machine

/wp-content/uploads/2016/05/23_959769.png

24 – The name of the certificate will be something like aps_development.cer.

/wp-content/uploads/2016/05/24_959770.png

25 – Click on Done

26 – Go in the folder where you downloaded the aps_development.cer and double click on it. The certificate is automatically installed in your Keychain. You can check that it’s installed correctly by going in the Keychain tool, selecting the Login Keychain and looking in the Category section under My Certificates.

/wp-content/uploads/2016/05/26_959771.png

27 – The certificate is installed correctly! Now we need to export it in a different format so that it can be used to create a provisioning certificate. Right click on it in the Keychain Tool and choose to Export it somewhere on your machine

/wp-content/uploads/2016/05/27_959772.png


28 – Save it as a .p12 format

/wp-content/uploads/2016/05/28_959773.png

29 – Enter a password to encrypt the certificate

/wp-content/uploads/2016/05/29_959774.png

30 – The new certificate is stored on your machine

/wp-content/uploads/2016/05/30_959775.png

31 – On the Apple Developer portal, go to the Provisioning Profiles –> All section

/wp-content/uploads/2016/05/31_959776.png

32 – Click on the “+” sign to create a new Provisioning Profile

33 – Select iOS App Development  and click on Continue

/wp-content/uploads/2016/05/33_959780.png

34 – Locate your app in the combo box and click on Continue

/wp-content/uploads/2016/05/34_959781.png

35 – Select the certificate that you want to include in this provisioning profile. In this case I’m choosing just the one related to my name

/wp-content/uploads/2016/05/35_959782.png

36 – Select the devices on which the application has to run and click on Continue. You can select several devices

/wp-content/uploads/2016/05/36_959783.png

37 – Keep the proposed name and click on Continue

/wp-content/uploads/2016/05/37_959784.png

38 – Download the provisoning profile on your machine

/wp-content/uploads/2016/05/38_959785.png

39 – Click on Done

/wp-content/uploads/2016/05/40_959786.png

40 – Double click on the provisioning profile certificate you just downloaded. It will be automatically installed in XCode

/wp-content/uploads/2016/05/41_959787.png

41 – Open Xcode and go in Xcode –> Preferences

/wp-content/uploads/2016/05/42_959788.png

42 – Click on View Details

/wp-content/uploads/2016/05/43_959789.png

43 – Under the iOS Development session you should be able to see your certificate

/wp-content/uploads/2016/05/44_959790.png

Let’s continue now with the last part of this article where you will learn how to use push notification with a hybrid application on your mobile devices.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.