QuickSync - How to get started

Our QuickSync feature is an improved way to synchronise your app users' devices with our server. Our default synchronisation lets a device poll for new notifications or geofence every once in awhile. This means that after create a notification it can take some time until you receive the notification when testing.

With Quicksync, this issue is resolved because after creating a notification it will be synchronized with all your users devices immediately.

Due to the huawei ban from Google services, Firebase doesn't support devices with HMS core, these are, all Huawei devices released after May 16th, 2019. To be able to use quicksync in these devices you need to use Huawei Push Kit service.

Firebase

Add QuickSync to receive your notifications immediately. This uses Firebase Messaging and it dependents on Google Play Services. Make sure you already have integrated Plot using the Android integration guide.

Step 1: Add Firebase Messaging Dependency

Add a dependency on Firebase in your app-level gradle file. The download page shows with what version it has been tested. It is possible it won't work with newer major versions of Google Play Services.

dependencies {
  //ensure the version of the Firebase libraries are the same as of your Google Play Services dependency
  compile 'com.google.firebase:firebase-core:' + googlePlayVersion
  compile 'com.google.firebase:firebase-messaging:' + googlePlayVersion
}
Step 2: Add Services

Add a service registration to your manifest as shown in the snippet if you don't have Firebase Messaging integrated yet.

<service android:name="com.plotprojects.retail.android.QuickSyncFirebaseMessagingService">
    <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

<service android:name="com.plotprojects.retail.android.QuickSyncFirebaseInstanceIdService">
    <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
    </intent-filter>
</service>

When you have your own Firebase Messaging services inside your app, you can forward calls from these services to our library. The QuickSyncFirebaseInstanceIdService has the static method handleTokenRefresh(Context) for tokenRefresh events and the QuickSyncFirebaseMessagingService has the static method handleMessageReceived(Context, RemoteMessage) for messageReceived events.

Step 3: Setup a Firebase Project

Follow the steps at the Firebase Console to setup your project and make sure you enable cloud messaging for your project.

Step 4: Add Config File

To obtain the google-services.json config file, add your Android app to Firebase by clicking on the "Add Firebase to your Android app" and following the instructions.

google-services.json

In case your Firebase project already has the Android app, go to the General tab in the Project Settings page and retrieve the config file, as shown in the image below.

Config file

Once the google-services.json config is downloaded, add it into your project's module folder, typically app/.

Step 5: Almost done!

After performing the steps above, in order to get the server key, click the settings button, highlighted in red, followed by Project Settings.

Server key new Firebase interface

Then look up the server key found in the Cloud Messaging tab of the Settings page, as presented below.

Server key new Firebase interface

Add that code to the dashboard in the Developer Tools page.

You are now ready to receive your first notification through QuickSync!

Huawei Push Kit

Add QuickSync to receive your notifications immediately. This uses Huawei Push Kit and it depends on HMS core. Make sure you already have integrated Plot using the Android integration guide.

Step 1: Integrate Push Kit in your app

Follow Huawei steps in order to integrate the Push Kit in your app

Step 2: Retrieve app information from Huawei.

For that go to your Huawei developer account and select apps.

Push Kit Apps

Select the app you wish to integrate.

Select app

Get the app id and app secret of the app.

App id and App secret

Step 3: Set the Huawei app id and app secret on our dashboard

Once you have the app id and app secret log in into the dashboard and go to Developer tools

developer tools

On the developer tools scroll down until the Quicksync section and add your Huawei app id and Huawei app secret

App id and App secret