Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

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

$
0
0

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:

LinkContent
How to use Push Notifications with iOS and Android Hybrid applications - part 1Step 1 - Enable push notifications for Android
This partStep 2 - Enable push notifications for iOS
How to use Push Notifications with iOS and Android Hybrid applications - part 3Steps 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…

08.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

06.png

 

7 - Enter your credentials

 

8 - Select your team if needed

 

9 - Click on Certificates, Identifiers & Profiles

07bis.png

 

10 - Click on on Identifiers --> App Ids

10.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.

12.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

13.png

 

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

14.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

17.png

 

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

18.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.

20.png

 

21 - Select the certificate and click on Choose

 

22 - Click on Continue

22.png

 

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

23.png

 

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

24.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.

26.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

27.png


28 - Save it as a .p12 format

28.png

 

29 - Enter a password to encrypt the certificate

29.png

 

30 - The new certificate is stored on your machine

30.png

 

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

31.png

 

32 - Click on the "+" sign to create a new Provisioning Profile

 

33 - Select iOS App Development  and click on Continue

33.png

 

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

34.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

35.png

 

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

36.png

 

37 - Keep the proposed name and click on Continue

37.png

 

38 - Download the provisoning profile on your machine

38.png

 

39 - Click on Done

40.png

 

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

41.png

 

41 - Open Xcode and go in Xcode --> Preferences

42.png

 

42 - Click on View Details

43.png

 

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

44.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.


Viewing all articles
Browse latest Browse all 2548

Trending Articles