Handling SMS Notifications in Android

improve this page | report issue


SMS notifications are a sub-set of Push Notification, as such make sure to first go through the Push notifications in Android tutorials.


Jump to:

Notifications API

In SMS notifications, when registering the device, a phone number value is passed.

Challenge Handlers

If the push.mobileclient scope is mapped to a security check, you need to make sure matching challenge handlers exist and are registered before using any of the Push APIs.


Required for the client application to connect to MFPPush service with the right application context.

  • The API method should be called first before using any other MFPPush APIs.
  • Registers the callback function to handle received push notifications.

Register Device

Register the device to the push notifications service.

MFPPush.getInstance().registerDevice(new MFPPushResponseListener<String>() {
    public void onSuccess(String s) {
        // Successfully registered

    public void onFailure(MFPPushException e) {
        // Registration failed with error
}, optionObject);
  • optionObject: an JSONObject containing the phone number to register the device with. For example:
JSONObject optionObject = new JSONObject();
try {
    // Obtain the inputted phone number.
    optionObject.put("phoneNumber", editPhoneText.getText().toString());
catch(Exception ex) {

You can also register a device using the Push Device Registration (POST) REST API

Unregister Device

Unregister the device from push notification service instance.

MFPPush.getInstance().unregisterDevice(new MFPPushResponseListener<String>() {
    public void onSuccess(String s) {
        // Unregistered successfully

    public void onFailure(MFPPushException e) {
        // Failed to unregister

Using an SMS subscribe servlet

REST APIs are used to send notifications to the registered devices. All forms of notifications can be sent: tag & broadcast notifications, and authenticated notifications

To send a notification, a request is made using POST to the REST endpoint: imfpush/v1/apps/<application-identifier>/messages.
Example URL:


To review all Push Notifications REST APIs, see the REST API runtime services topic in the user documentation.

To send a notification, see the sending notifications tutorial.

Image of the sample application

Sample application

Click to download the Android project.

Note: The latest version of Google Play Services is required to be installed on any Android device for the sample to run.

Sample usage

Follow the sample’s README.md file for instructions.

Last modified on January 30, 2017