Integrating Firebase Cloud Messaging with your application

 1. Setting up the project

  • Create a Firebase project in the Firebase console by clicking on Add project.
  • Click Add Firebase to your Android app.
  • A window will appear asking you for your application’s package name:

Screen_Shot_2017-04-10_at_4.28.28_PM.png

  • The package name should match the one indicated in the AndroidManifest.xml file in your project directory as shown below:

    Screen_Shot_2017-04-10_at_1.36.03_PM__1_.png

  • After adding the application to the Firebase console, you will be prompted to download a google-services.json file. Download and place the file into your Android app module root directory.

2. Adding Firebase support to Android studio project.

Add the following rules to your root-level build.gradle file, to enable google-services plugin:

Project-level build.gradle (<project>/build.gradle):

buildscript {
    dependencies {
        // Add this line
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

In your app-level Gradle file (app/build.gradle), add the apply plugin at the bottom, and also add the Firebase dependency:

App-level build.gradle(<project>/<app-module>/build.gradle)

Screen_Shot_2017-11-17_at_4.58.00_PM.png

Note: If you run into any runtime errors, you may need to use firebase-core version 11.2.2.

 
3. Uploading the API key to Skillz 

  • Go to https://console.firebase.google.com/, and select your project.
  • Select Settings (top left corner of the console)

    Screen_Shot_2017-04-10_at_4.48.59_PM__1_.png

  • Select Cloud messaging tab
  • Copy the server key
  • Go to your Skillz developers console and select your application
  • Select the Push Notification tab on your left
  • In the Android - GCM Push notification, paste your server key to the blank text field, and hit Save:

    Screen_Shot_2017-05-12_at_10.51.14_AM.png