Skip to content

Push Notifications

To enable push notification you will need to integrate Google Firebase in your app:

1. If you don't already have a Firebase project, create one at Google Firebase Console.
Inside the project, select "Add Firebase to your Android app" (make sure to enter the right package name of your app).

2. Download google-services.json file to your computer and copy it in your project

platforms/android
platforms/android/app

folder.

google-services.json

3. Configure google-services in your gradle file(s):

// In your project platforms/android/build.gradle make sure to include the following:

buildscript {
    repositories {
        google() // <-- Probably you should ADD THIS if it's missing
        jcenter()
        // ...
    }

    // ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0' // <-- 3.0.0 is the minimum to support google() repo
        classpath 'com.google.gms:google-services:4.1.0' // <-- Probably you should ADD THIS
        // ...
    }
}
// ...

task wrapper(type: Wrapper) {
    gradleVersion = '4.1.0' // <-- 4.1.0 is the minimum to support google() repo
}

apply plugin: 'com.google.gms.google-services' // Include at the BOTTOM of file
// In your project platforms/android/build.gradle make sure to include the following:

buildscript {
    repositories {
        google() // <-- Probably you should ADD THIS if it's missing
        jcenter()
        // ...
    }

    // ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0' // <-- 3.0.0 is the minimum to support google() repo
        classpath 'com.google.gms:google-services:4.1.0' // <-- Probably you should ADD THIS
        // ...
    }
}
// ...

apply plugin: 'com.google.gms.google-services' // Include at the BOTTOM of platforms/android/app/build.gradle file


4. Copy your project FCM Cloud Messaging Server Key from Google Firebase Console
(See the screenshot below and make sure to use the right api key) fcmkey

5. Open NearIT web interface, select your app and navigate to “Settings > Push Settings”. Paste your project FCM Key under the “Setup Android push notifications” block. nearitsettings


WARNING: Do not follow any further FCM-specific instructions: we automatically handle all the other part of the process inside the SDK code.