Hello 👋 How can we help?

Enable push notifications for Android (optional)

Push notifications are great for real-time messaging and informing your app users that there is a new message for them.
Written by Alex
Updated 2 weeks ago

We believe that push notifications are a great way to add real-time messaging to your application and inform your app users that there is a new message from HelpCrunch (i.e. from your admin dashboard). It allows you to stay in touch with your users even when the application is not in the foreground.

The HelpCrunch Mobile SDK does not necessarily require implementing push notifications. Without push notifications, your app's users will still be able to receive new messages, but they will only discover them after opening the HelpCrunch window.

We use Firebase Cloud Messaging (FCM). Is a cross-platform messaging solution that lets you reliably deliver messages at no cost.

So, to add push notifications to your app, you'll need:

  1. Add google-services.json to the app/ folder 
  2. To enable Firebase products in your app, add the google-services plugin to your app/build.gradle file. In your root-level (project-level) Gradle file (build.gradle), add rules to include the Google Services plugin. Check that you have Google's Maven repository as well. 
buildscript {

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
  }

  dependencies {
    // ...

    // Add the following line:
    classpath 'com.google.gms:google-services:4.2.0'  // Google Services plugin
  }
}

allprojects {
  // ...

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
    // ...
  }
}
In your module (app-level) Gradle file (usually app/build.gradle), add a line to the bottom of the file.
apply plugin: 'com.android.application'
android {
     // ...
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin

Did this answer your question?