Posts Tagged ‘push notifcations’

With Push Notification contribution that is available, implementing push notifications was very simple and straightforward. A big thanks to the contributor.

To get push notifications working on Android, one needs to set up Google Cloud Messaging. Google has this well documented and the steps can be found here.

Once GCM has been set up, goto your Drupal website and install push_notifications and drupalgap_mobile_notifications plugins. Enable them after installation. Once you have enabled the plugins, goto the permissions of push_notifications and adjust the permissions of creating and removing device tokens as per your application needs. In my case, I wanted tokens to be created even for anonymous users so I had granted permissions for the same and had made the required changes in the drupalgap push_notifications module. Also place the GCM_SENDER_ID that was generated while setting up GCM in the variable defined in push_notifications.js right at the top.

Goto Configuration -> Push Notifications -> Configuration to setup the push notifications module. In the bottom provide the API key that was generated in your GCM developer console and save the configuration.

Now we’re all set in the Drupal end to send notifications. Setting up the Drupalgap end is very straight forward. Download the push_notifications module and place it in the apps/modules/custom/push_notifications directory.

Add an entry to the settings.js to register the custom module.

Once this is done, launch the app to make sure that the device token gets registered with the Drupal push_notifications module. It can be verified by going to Configuration -> Push Notifications -> Overview which shows the number of device tokens registered per platform.

When you’ve verified that there are registered tokens, click on the Send Push tab to compose a Push message and send it across.