To setup Google Cloud Messaging on your application you will have to register with GCM and set up a Google API Project on your Google Developers Console (https://developers.google.com/mobile/add):
First pick Android App Platform
Specify your application name
Example:
Asynchronous Android
Supply your application package name
Example:
com.packpublishing.asynchronousandroid
Select Cloud Messaging Services and Enable Google Cloud Messaging
Generate the configuration files and download the JSON configuration file
google-services.json
to your computer.Save your credentials (Server APIKey, SenderId) to authenticate with the GCM platform
Once you have registered your application with GCM, get the google-services.json
configuration file and copy the file into the app/
or mobile/
directory of your Android Studio Project.
Next, add the Google Play Services SDK to your project level and app-level <PROJECT_DIRECTORY>/build.gradle
file and rebuild...