This chapter contains the steps you need to set up your Android Rhodes client and RhoConnect server for push messaging. After you perform the steps in this chapter, you will finish by performing the client setup that is needed for all platforms.
If you are setting up RhoConnect Push Service on an Android client, you do not perform the steps in this chapter. Perform the steps in RhoConnect Push Service setup instead.
Google has officially deprecated the C2DM service and requires that you now use Google Cloud Messaging (GCM). Please see Google’s announcement for more details.
To set up your Android Rhodes client application and RhoConnect server application for RhoConnect Push, you need to set up Android Google Cloud Messaging (GCM).
To do so, perform the following sections from the GCM Getting Started guide.
You can optionally stop in these Getting Started instructions once you complete the Obtaining an API Key section.
You may read common GCM docs at the Google developer site.
To set up your RhoConnect application for Android Google Cloud Messaging (GCM), you must have first set up Android Google Cloud Messaging. Then you can find your GCM API key in your Google apis dashboard.
settings/settings.yml to include your GCM API key:
:development: :redis: localhost:6379 :syncserver: http://localhost:9292/application/ :licensefile: settings/license.key :gcm_api_key: your_gcm_api_key_here
Enable push in your Rhodes client application in build.yml.
capabilities: - push
Here are some guidelines for developing and testing an Android application that uses the Android Google Cloud Messaging feature.
To set up your Rhodes client application for Android Google Cloud Messaging (GCM), you must have first set up Android Google Cloud Messaging, where you noted the Google API project number.
Register the Google API project number for your client application. Modify your application’s build.yml to specify the Google API project number used to send PUSH messages:
android: push: sender: <Google API project number>
On the Android client, it is possible to set up status bar notifications for PUSH messages. In this case, push notification can be shown on the Android status bar after ruby callback. The user can activate application by touching this notification. There are two modes available for push notifications: – always – push notification is shown always – background – push notification is shown only if application is backgrounded (not started) If no push notification mode is specified in build.yml then no notifications are shown at all.
android: push: notifications: background
Once you have completed the above steps for setting up push on Android client and RhoConnect server, you must still perform the client setup that is needed for all platforms.