Using a custom messaging service for Android

Overview

The sdk allows customers to use their own custom messaging service instead of the SDK's FCM implementation.

Step-by-step

1. Configure the custom messaging service

To set the custom messaging service as the SDK's messaging service, complete the following:

  1. Set the messagingService value of the SDK configuration to custom.
  2. Create a custom messaging service implementation.
  3. Add a file to mce/plugins assets folder with the following content:

{ "messagingService": "" } To create a custom messaging service implementation, the customer should implement the SDK's MessagingService interface.

Sample code:

import android.content.Context;

import co.acoustic.mobile.push.sdk.api.MceSdkConfiguration;
import co.acoustic.mobile.push.sdk.api.MessagingService;

public class CustomMessagingService implements MessagingService {
@Override
public void initialize(Context context, MceSdkConfiguration mceSdkConfiguration)

{ // code that runs on sdk init }@Override
public boolean register(Context context)

{ // perform any service registration code here. return true if registration is possible or false otherwise return true; }@Override
public String getServiceName()

{ // define the name of the messaging service return "MyCustomService"; }}