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 app module root folder (not in the project root folder!). google-services.json

3. Add the right dependency in your root-level build.gradle file:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
    }
}

Then, enable the plugin in your module Gradle file (usually the app/build.gradle):

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'



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

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



The SDK creates a system notification for every push recipe it receives. On the notification tap, your launcher activity will start. To learn how to deal with in-app content once the user taps on the notification, see this section.

If you want to customize your notifications, see this section.


WARNING: If you experience build or runtime problems with google play services components, make sure to include the right version of any gms dependency in your app. Example:

implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-location:16.0.0'

Conflicting play services version may result in compile-time and run-time errors.