Get Push Notification [Optional]

MCS has Trigger & Action function. The user can set the trigger and action for a data channel when its value passes the limit of the defined range. The user will get email notification or the GCM notification based on the trigger and action setting.

Setup

Please be sure you have

  1. Create your own Google Cloud Messaging project to obtain GCM_SENDER_ID and GCM_API_KEY.
  2. Follow the step of MCS Android SDK - Setup with Push Installation

Check it on MCS Website

If the setup is correct, then the mobile device is registered to MCS Server when you get OnSuccess() response of McsPushInstallation.getInstance().registerInBackground().

McsPushInstallation.getInstance().registerInBackground(
    "YOUR_GCM_SENDER_ID", "YOUR_GCM_API_KEY",
    new McsResponse.SuccessListener<JSONObject>() {
        @Override public void onSuccess(JSONObject response) {
            // If you correctly setup with push installation, 
            // the mobile device is registered to MCS Server at this point.
            McsLog.d("This mobile's id: " + McsMobile.getMobileId());
        }
    },
    new McsResponse.ErrorListener<JSONObject>() {
        @Override public void onError(Exception error) {
            // something went wrong
        }
    }
);

Or, you can see it in the User Profile page.

img-mobiles

Please refer to Push Notifications- MCS Android SDK API Reference for detailed mechanism behind McsPushInstallation.getInstance().registerInBackground().

Trigger and Action

Note that you have to manually switch on the notification for each registered mobile. The mobile notification is default as false.

Please be sure you have already turn on the notification in both

  1. User Profile page
  2. Test device page

to receive push notification. Check Setting trigger and action for different mobiles section for detailed information.

Also, only true devices could trigger actions. True devices make request with header that contains deviceKey. Manipulation on MCS website or Mobile app will NOT trigger any action. Check Upload data points section for detailed information.