Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member190010
Contributor

Hi All,

The objective of this post is to explain all the methods that are available for registering a device in the SAP Mobile Platform using android programming.

I thought this was an important topic since there are many possible approachs to perform the registration, and it is difficult to get an insight in each of them when you are just giving your first steps using the SAP Mobile Platform and all the tools that it provides.

First of all, let's give a little definition of what is the On-boarding.

User on-boarding is the process of registering a user and giving them appropriate access to data and applications. Without being onboarded, a device is not available to use any of the functionalities provided by the SAP Mobile Platform, as Push Notifications, using authentication, etc.


There are three methods available for registering a device into the SMP for Android Native programming:

1) Calling the registration Endpoint provided by SMP


Request:

URL:

https://<SMP Server address>:<SMP Port>/odata/applications/latest/<appId>/Connections


METHOD:

POST


Header:

Content-Type: application/xml


Payload:

<?xml version="1.0" encoding="UTF-8"?>

<entry xmlns="http://www.w3.org/2005/Atom"

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">

<content type="application/xml">

<m:properties>

<d:DeviceModel>Samsung Galaxy S2</d:DeviceModel>

<d:DeviceType>Android</d:DeviceType>

<d:DeviceSubType>Smartphone</d:DeviceSubType>

<d:DevicePhoneNumber>555-555-1212</d:DevicePhoneNumber>

<d:DeviceIMSI>123456</d:DeviceIMSI>

</m:properties>

</content>

</entry>

Response:

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"xml:base="http://<host>:<port>/odata/applications/latest/<appId>/">

<id>

http://<host>:<port>/odata/applications/latest/<appId>/Connections('e6b41263-9d9d-4152-b148-34b95ae01a97')

</id>

<title type="text" />

<updated>

2016-02-24T20:23:38Z

</updated>

<author>

<name />

</author>

<link rel="edit" title="Connection" href="Connections('e6b41263-9d9d-4152-b148-34b95ae01a97')" />

<category term="applications.Connection" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

<content type="application/xml">

<m:properties>

<d:ETag>

2016-02-24 17:23:38.0

</d:ETag>

<d:ApplicationConnectionId>

e6b41263-9d9d-4152-b148-34b95ae01a97

</d:ApplicationConnectionId>

<d:AndroidGcmPushEnabled m:type="Edm.Boolean">

true

</d:AndroidGcmPushEnabled>

<d:AndroidGcmRegistrationId m:null="true" />

<d:AndroidGcmSenderId>

333666698688

</d:AndroidGcmSenderId>

<d:ApnsPushEnable m:type="Edm.Boolean">

true

</d:ApnsPushEnable>

<d:ApnsDeviceToken m:null="true" />

<d:ApplicationVersion>

  1. 1.0

</d:ApplicationVersion>

<d:BlackberryPushEnabled m:type="Edm.Boolean">

false

</d:BlackberryPushEnabled>

<d:BlackberryDevicePin m:null="true" />

<d:BlackberryBESListenerPort m:type="Edm.Int32">

0

</d:BlackberryBESListenerPort>

<d:BlackberryPushAppID m:null="true" />

<d:BlackberryPushBaseURL m:null="true" />

<d:BlackberryPushListenerPort m:type="Edm.Int32">

0

</d:BlackberryPushListenerPort>

<d:BlackberryListenerType m:type="Edm.Int32">

0

</d:BlackberryListenerType>

<d:CollectClientUsageReports m:type="Edm.Boolean">

false

</d:CollectClientUsageReports>

<d:ConnectionLogLevel>

NONE

</d:ConnectionLogLevel>

<d:CustomizationBundleId m:null="true" />

<d:CustomCustom1 />

<d:CustomCustom2 />

<d:CustomCustom3 />

<d:CustomCustom4 />

<d:DeviceModel>

Samsung Galaxy S2

</d:DeviceModel>

<d:DeviceType>

Android

</d:DeviceType>

<d:DeviceSubType>

Smartphone

</d:DeviceSubType>

<d:DevicePhoneNumber>

555-5525-1212

</d:DevicePhoneNumber>

<d:DeviceIMSI>

123456

</d:DeviceIMSI>

<d:E2ETraceLevel>

Low

</d:E2ETraceLevel>

<d:EnableAppSpecificClientUsageKeys m:type="Edm.Boolean">

false

</d:EnableAppSpecificClientUsageKeys>

<d:FeatureVectorPolicyAllEnabled m:type="Edm.Boolean">

true

</d:FeatureVectorPolicyAllEnabled>

<d:LogEntryExpiry m:type="Edm.Int32">

7

</d:LogEntryExpiry>

<d:MaxConnectionWaitTimeForClientUsage m:null="true" />

<d:MpnsChannelURI m:null="true" />

<d:MpnsPushEnable m:type="Edm.Boolean">

false

</d:MpnsPushEnable>

<d:PasswordPolicyEnabled m:type="Edm.Boolean">

false

</d:PasswordPolicyEnabled>

<d:PasswordPolicyDefaultPasswordAllowed m:type="Edm.Boolean">

false

</d:PasswordPolicyDefaultPasswordAllowed>

<d:PasswordPolicyMinLength m:type="Edm.Int32">

8

</d:PasswordPolicyMinLength>

<d:PasswordPolicyDigitRequired m:type="Edm.Boolean">

false

</d:PasswordPolicyDigitRequired>

<d:PasswordPolicyUpperRequired m:type="Edm.Boolean">

false

</d:PasswordPolicyUpperRequired>

<d:PasswordPolicyLowerRequired m:type="Edm.Boolean">

false

</d:PasswordPolicyLowerRequired>

<d:PasswordPolicySpecialRequired m:type="Edm.Boolean">

false

</d:PasswordPolicySpecialRequired>

<d:PasswordPolicyExpiresInNDays m:type="Edm.Int32">

0

</d:PasswordPolicyExpiresInNDays>

<d:PasswordPolicyMinUniqueChars m:type="Edm.Int32">

0

</d:PasswordPolicyMinUniqueChars>

<d:PasswordPolicyLockTimeout m:type="Edm.Int32">

0

</d:PasswordPolicyLockTimeout>

<d:PasswordPolicyRetryLimit m:type="Edm.Int32">

20

</d:PasswordPolicyRetryLimit>

<d:ProxyApplicationEndpoint>

http://ema.dummy.com

</d:ProxyApplicationEndpoint>

<d:ProxyPushEndpoint>

http://localhost:8080/Notification

</d:ProxyPushEndpoint>

<d:PublishedToMobilePlace m:type="Edm.Boolean">

false

</d:PublishedToMobilePlace>

<d:UploadLogs m:type="Edm.Boolean">

false

</d:UploadLogs>

<d:WnsChannelURI m:null="true" />

<d:WnsPushEnable m:type="Edm.Boolean">

true

</d:WnsPushEnable>

<d:InAppMessaging m:type="Edm.Boolean">

false

</d:InAppMessaging>

<d:FeatureVectorPolicy m:type="Bag(applications.FeatureVectorPolicy)" />

</m:properties>

</content>

  </

entry>


If you want to investigate more in detail this method, please refer to the following URL:

http://help.sap.com/saphelp_smp307sdk/helpdata/en/8a/251b61893340c6ad2ba418679a19d1/content.htm


2) Using the MAF Logon Component


The MAF Logon component is one of the most common reusable components of the Mobile Application Framework (MAF) and it provides easy integration for applications that use logon UI behavior. It is a key component, because before any communication can take place with a backend OData producer, the app needs to on-board users onto the SAP Mobile Platform.

This component can be very useful if you are looking for a quick win, but in the case you want to developer an application that provides a personalized experience, I would recommend to go for the method 3.

This component is perfect if you are doing some test, or if you are building a PoC.


If you want to get more details from this component, check the following post:

http://a248.g.akamai.net/n/248/420835/5df1fcfbdd794e073a8acd0f584ac9fd679f1b00fe2ee8a7b95788cd6d17c4...


It is important to clear out, that there is a way to customize a little bit this screen, and this is explained in the following blog:

Customizing MAF Logon Component in Android


Below some screens on how this component looks like:







3) Using the oData SDK


This is the best method if you are looking for a personalized experience, where you can define the screen with all the fields you want to show, and whatever look & feel you want to use.

For instance, below you can see an example of a custom screen design, different to the one provided by the MAF Logon Component.



If you are interested in this approach, I encourage you to take a look at the following post:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30304722-614d-3210-65a6-faf86a032...


See you in the next post!

Emanuel