Google Cloud Messaging Integration for Android

Pre-requisites:

  • You know how to create a basic app in Android Studio.
  • You know how to fix import issues and modify codes in Java.
  • You have an android device to run the app, simulator doesn’t work for gcm.
  • You have a google account.

1. Create google cloud messaging backend module in your Android app.

File -> New -> New Module -> Google Cloud Message -> Next -> select App Engine Backend with Google Cloud Messaging from the Modlue type drop down -> Finish

2. Change the File Explorer Menu from Android to Project, and find the appengine-web.xml in the backend folder, then follow this readme

3. Build the backend module and deploy it to Google App Engine.
Select backend from the dropdown next to the run button in Android Studio -> Build -> Rebuild Project -> Deploy Module to App Engine -> it will ask you to sign into your google account in Android Studio

4. Go to Google Developer Console and find App Engine Dashboard and then find the url for your Google Cloud Messaging.

5. Switch back to app from the dropdown menu next to the run button in Android Studio.

6. Follow the README in the java folder from this repo.

7. Follow the README in the gradle folder from this repo.

8. Install and run your Android app on a device.

9. Go to your Google Cloud Message console (ex: https://yourapp-id.appspot.com/) and send a push notification message, and expect that to be received from your device. It doesn’t work on emulators.

Goole Developer Console Project Dashboard

Google Cloud Messaging Console

Push Notification Received on Your device

Search within Codexpedia

Custom Search

Search the entire web

Custom Search