Dec 11

Mobile Integrations – Push Notifications


In this post, we will outline how to interact with Google Cloud Messaging (GCM) and push messages to a device.


Step 1: Register your app with GCM Server and get Sender Id.

  1. Go to Google Developer Console and register your app name and app package(optional) click on continue.
  2. You will get API Key ( needed when you push a message) and Sender Id as below and keep this data copied and safe which we need in further steps.

Step 2: Create a mobile app with the SenderId from Step 1 and configure it to receive notifications

    1. Create a Hybrid Mobile project in WaveMaker using the same app name that you registered with GCM server in the previous step.
      Note: As the project name containing special characters is not allowed in Google Developer Console, create the project in WaveMaker without any special character including ‘_’.
    2. Import the gcm.server.jar and json-simple-1.1.1.jar files into your project using Import -> Jar option from Main Menu.
    3. Create a Java Service for push notification

using the following code:

  1. In app.js, include the below code for registering the push notification:
    For more details, refer to push API

  • To invoke the service create a push notification service variable.
  • The GCM Push Notification service requires API Key, sender ID, deviceID (or array of deviceId’s).


Step 5: Building Mobile App with required Cordova Plugin.

Install Cordova on your machines and once you have it ready then do following for mobile app of GCM:

  1. Export Cordova Zip from WaveMaker
  2. Unzip it and you see a config.xml and two folders
  3. Specify the plugin in config.xml
  4. Go to cmd line and navigate to the unzipped folder
  5. The run the below commands in sequence
  6. Install the apk file from platforms/android/build/outputs/apk folder
We use cookies to provide you with a better experience. By using our website you agree to the use of cookies as described in our Privacy Policy.