DreamFactory 2.5 now supports the Google Cloud Messaging Service (GCM). This blog post will show you how easy it is configure DreamFactory as your Android app’s push notification provider. Note that GCM support is a premium feature in DreamFactory's Silver and Gold products, not an open source feature.
GCM is a native DreamFactory service that supports role-service-access, live API documentation, script access, etc. Once you've configured GCM in DreamFactory, all the configuration details are hidden from your client. They are securely stored in your DreamFactory instance database. This provides a simple way for your Android application to send push notifications with DreamFactory.
Configuring a GCM service is as easy as configuring any other services in the DreamFactory admin console. Start by logging into the admin console, head over to the ‘Services’ tab, and click on the ‘Create’ button on the left sidebar. Use the ‘Service Type’ drop down to select ‘Notification’ -> ‘GCM Push Notification’, complete the service configuration form and save it to create your service.
In the ‘Info’ tab, provide basic service information - Name, Label, and Description.
Then in the ‘Config’ tab, provide the following configuration information:
- API Key - String. Required. Enter you GCM server API Key here.
- Environment - String. Required. Select your Android application environment - Development or Production.
- Service Event - Array. Optional. Here you can tie this GCM service to any number of system events. In the example below we have tied our GCM service with two events - “system.admin.session.post” and “system.admin.session.delete”. These events are fired respectively when a system admin logs in and logs out of the DreamFactory. It automatically fires this GCM service and sends a push notification to targeted devices. You can enter the push notification message in the Message field.
Once you've configured your GCM service, head over to the ‘API Docs’ tab and expand your newly created service to see the API endpoints that are ready to use. You can learn more about these endpoints in the DreamFactory docs.
In this post, we quickly covered how simple it is to use DreamFactory to manage and send Android push notifications with the Google Cloud Messaging Service. Head on over to the community forum to discuss or let us know what you think in the comments!