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:
<entryxmlns="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>
<titletype="text" />
<updated>
2016-02-24T20:23:38Z
</updated>
<author>
<name />
</author>
<linkrel="edit"title="Connection"href="Connections('e6b41263-9d9d-4152-b148-34b95ae01a97')" />
<categoryterm="applications.Connection"scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<contenttype="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:AndroidGcmPushEnabledm:type="Edm.Boolean">
true
</d:AndroidGcmPushEnabled>
<d:AndroidGcmRegistrationIdm:null="true" />
<d:AndroidGcmSenderId>
333666698688
</d:AndroidGcmSenderId>
<d:ApnsPushEnablem:type="Edm.Boolean">
true
</d:ApnsPushEnable>
<d:ApnsDeviceTokenm:null="true" />
<d:ApplicationVersion>
- 1.0
</d:ApplicationVersion>
<d:BlackberryPushEnabledm:type="Edm.Boolean">
false
</d:BlackberryPushEnabled>
<d:BlackberryDevicePinm:null="true" />
<d:BlackberryBESListenerPortm:type="Edm.Int32">
0
</d:BlackberryBESListenerPort>
<d:BlackberryPushAppIDm:null="true" />
<d:BlackberryPushBaseURLm:null="true" />
<d:BlackberryPushListenerPortm:type="Edm.Int32">
0
</d:BlackberryPushListenerPort>
<d:BlackberryListenerTypem:type="Edm.Int32">
0
</d:BlackberryListenerType>
<d:CollectClientUsageReportsm:type="Edm.Boolean">
false
</d:CollectClientUsageReports>
<d:ConnectionLogLevel>
NONE
</d:ConnectionLogLevel>
<d:CustomizationBundleIdm: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:EnableAppSpecificClientUsageKeysm:type="Edm.Boolean">
false
</d:EnableAppSpecificClientUsageKeys>
<d:FeatureVectorPolicyAllEnabledm:type="Edm.Boolean">
true
</d:FeatureVectorPolicyAllEnabled>
<d:LogEntryExpirym:type="Edm.Int32">
7
</d:LogEntryExpiry>
<d:MaxConnectionWaitTimeForClientUsagem:null="true" />
<d:MpnsChannelURIm:null="true" />
<d:MpnsPushEnablem:type="Edm.Boolean">
false
</d:MpnsPushEnable>
<d:PasswordPolicyEnabledm:type="Edm.Boolean">
false
</d:PasswordPolicyEnabled>
<d:PasswordPolicyDefaultPasswordAllowedm:type="Edm.Boolean">
false
</d:PasswordPolicyDefaultPasswordAllowed>
<d:PasswordPolicyMinLengthm:type="Edm.Int32">
8
</d:PasswordPolicyMinLength>
<d:PasswordPolicyDigitRequiredm:type="Edm.Boolean">
false
</d:PasswordPolicyDigitRequired>
<d:PasswordPolicyUpperRequiredm:type="Edm.Boolean">
false
</d:PasswordPolicyUpperRequired>
<d:PasswordPolicyLowerRequiredm:type="Edm.Boolean">
false
</d:PasswordPolicyLowerRequired>
<d:PasswordPolicySpecialRequiredm:type="Edm.Boolean">
false
</d:PasswordPolicySpecialRequired>
<d:PasswordPolicyExpiresInNDaysm:type="Edm.Int32">
0
</d:PasswordPolicyExpiresInNDays>
<d:PasswordPolicyMinUniqueCharsm:type="Edm.Int32">
0
</d:PasswordPolicyMinUniqueChars>
<d:PasswordPolicyLockTimeoutm:type="Edm.Int32">
0
</d:PasswordPolicyLockTimeout>
<d:PasswordPolicyRetryLimitm:type="Edm.Int32">
20
</d:PasswordPolicyRetryLimit>
<d:ProxyApplicationEndpoint>
</d:ProxyApplicationEndpoint>
<d:ProxyPushEndpoint>
http://localhost:8080/Notification
</d:ProxyPushEndpoint>
<d:PublishedToMobilePlacem:type="Edm.Boolean">
false
</d:PublishedToMobilePlace>
<d:UploadLogsm:type="Edm.Boolean">
false
</d:UploadLogs>
<d:WnsChannelURIm:null="true" />
<d:WnsPushEnablem:type="Edm.Boolean">
true
</d:WnsPushEnable>
<d:InAppMessagingm:type="Edm.Boolean">
false
</d:InAppMessaging>
<d:FeatureVectorPolicym: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:
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:
See you in the next post!
Bye
Emanuel