Below, we’ll show you how to send push notifications and/or push messages to your customers, with Firebase Cloud Messaging (FCM) in Acquire.

Step 1. Enable Google services for your app

If you already have a Firebase project with notifications enabled you can skip to the next step. Otherwise go to the FCM Console page and create a new project following these steps:

Give the project a name and click ‘Create Project’.

Once your project is set up, scroll down and select ‘Get started’ on the ‘Notifications’ card.

Enter your app’s package name and click ‘Add App’.

Step 2. Setup client to receive push

Your google-services.json should automatically download. You’ll need to move that into the same directory as your application level build.gradle.

In your apps build.gradle you will need to add the following lines to your dependencies:

dependencies {
compile 'io.acquire.android:acquire-sdk-fcm:4.+'
compile 'com.google.firebase:firebase-messaging:11.+'
}

At the bottom of your build.gradle you must add:

apply plugin: 'com.google.gms.google-services'

It is important that this is at the very end of the file.

Step 3. Add your Server key to Acquire for Android settings

Finally, click the settings cog and select ‘Project settings’, then ‘Cloud Messaging’ and copy your Server key.

Open your Acquire app’s settings and select ‘Acquire for Android’. Then find the ‘Enable Google Cloud Messaging’ section. Here you'll be able to paste and save your Server API key.

Step 4. Setting your FCM icon

If you want to add a custom icon for your notifications, just add an image named chat_icon_aqr_white.png to each of your supported densities. Please note that vector drawables cannot be used here. For example:

/res/drawable-xxhdpi/chat_icon_aqr_white.png
/res/drawable-xhdpi/chat_icon_aqr_white.png
/res/drawable-hdpi/chat_icon_aqr_white.png
/res/drawable-mdpi/chat_icon_aqr_white.png

Notifications icon design guidelines

We recommend following these material design guidelines for producing this icon.

Troubleshooting tips

If you’re having trouble getting FCM to work in your app, here's a list of things you should check:

  • Make sure to tick the 'Send a push notification' box when you send a manual message.

  • Check that the notifications are not disabled for your app on your test device. Settings > Sound & Notification > App notifications. This may differ depending on the Android version.

  • Did you specify the correct Push Server API key?

  • Make sure you added your google-services.json file in the correct directory.

  • And as always, you can contact us via Acquire. We're always here to help