Register and enable your Android device clients to receive push
notifications.
- Obtain a GCM Sender ID. See instructions in Google's documentation for
"Registering for GCM."
- In SAP Control Center configure push
notification:
- In the Android Push Notifications section of the corresponding
Application Template use the GCM Sender ID value to update the Sender ID, and set
Enabled to true.
- Select Application > Properties > Push Configurations > Add
to configure push settings in the application properties (setting the GCM server URL,
and other parameters).
- Use the API key from GCM to configure the API key.
- Perform a one-time registration to enable push notifications for the application:
- Create an application connection. For example, for Android
devices:
POST http://{domain-host-port}/odata/applications/v1/{appid}/Connections
HTTP Header "Content-Type" = "application/atom+xml"
Body:
<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>
Note: You can check the "AndroidGcmPushEnabled" value returned from the
registration and only continue with the rest of the GCM/notification registration
processing if it is "true".
- The application registers with the GCM server, using the value from
the "AndroidGcmSenderId" property, as well as the Android Application ID (which you
build into the application).
A successful GCM registration results
in a Registration ID back from Google.
- Using the ApplicationConnectionId ({appcid}) returned from the
SAP Mobile Platform registration call (in either the
"X-SUP-APPCID" HTTP header or the "ApplicationConnectionId" property), the application
should update the AndroidGcmRegistrationId property for the application connection for
your application by using the GCM Registration ID returned by Google:
PUT http://{domain-host-port}/odata/applications/v1/{appid}/Connections/('{appcid}')
HTTP Headers "Content-Type" = "application/atom+xml" and "X-HTTP-METHOD" = "MERGE"
Body:
<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:AndroidGcmRegistrationId>{GCM registration ID}</d:AndroidGcmRegistrationId>
</m:properties>
</content>
</entry>
- Native mobile listener should be implemented by the application to get
the notification.