Want mobile push messaging with #SAPNWCloud ? Fork away!
Mobile push messaging should be an essential part of the real-time enterprise and now it’s easy to achieve with sapnwncloud . Mobile push messaging enable you to instantly push important business event to the mobile phones of decision makers in the business. They can then take the appropriate action.
I hereby release two open-source projects that will handle most of the complexity involved in such scenarios. It’s released on github under Apache 2.0 license,and and therefore should be very compatible for most purposes. Github also makes it dead easy and encourages you to fork the project, so please do!
For now, the projects supports Android through Google Cloud Messaging. But with some assistance from the community, I’m sure we will be able to support iOS devices (Apple Push Notification Service) and other emerging mobile platforms soon.
The reference android app implementation is available here (link to android .apk)
The reference backend implementation is hosted on #sapnwcloud https://androidgcmbackendp013234trial.nwtrial.ondemand.com/nwcloud-androidgcm-backend/
The project provides a backend for handling the mobile push messages.
It has the following responsibilities:
- Keep track of registered devices
Handled through a REST interface called from the mobile clients
- Provide a push message interface to clients
Handled through a REST interface called from an onPremise solution, a mobile client or any other program
- Send the push message to the mobile client
Uses the framework provided by the mobile platform. Currently, only Google Cloud Messaging is used but easily extendable.
(requires that we create a Google API project with GCM and that we generate a server API key)
This project uses JPA for persistence and Jersey for REST interface.
This android app is a reference app that provides two main functionalities:
- Register the android device and the app so that it can receive mobile push messages.
This registration is done to Google’s GCM service and to the #sapnwcloud backend application.
This step is required before it can receive any messages
- Send mobile push message to other mobile devices
This uses only the REST interface of the #sapnwcloud backend app (requires that other mobile devices are also registered in the backend)
When the app is started, it contacts Google’s GCM service and receives a registration key. This registration key is specific for the device and the Google API project we use (shared API project for app and the backend). The registration key and the email address of the user is then sent to the REST interface of the backend. We use email as an indicator of the device that should receive the mobile push message.
The app then fetches a list of all the emails that are registered in the backend, and allows you to type a message.
When you select to send the message, the app will send it to the backend using the REST interface. The backend will then subsequently send it to the recipient over the Google Cloud Messaging service (for this it uses the registration key of the recipient).
Please note that this app only illustrates one possible way to trigger a mobile push message through the backend.
This project uses google-http-client-java for performing REST (it’s transparent serialization from Java objects to JSON and back is awesome)
Other client uses
You do need an app on the device in order to register to the push service. However, once it is registered the push message could be initiated from anywhere.
The #sapnwcloud backend provides a REST interface over HTTP, so all a potential client needs to support is plain HTTP.
Here are some examples that can be implemented easily:
- A workflow has entered a critical step that must be handled immediately. The workflow will call the REST interface of the #sapnwcloud backend and pass a message and the emails of the recipients. The push message is almost instantly sent to the mobile devices who can take the appropriate actions.
- A new prioritized work order is created and should be handled before existing ones. The onPremise system can send a message to the worker which is already using a mobile app for planning his work
Enjoy, and on behalf of the SAPMentors; keep sharing!