Overview

Skill Level: Any

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

Prerequisites

Not what you’re looking for? Check out all our available tutorials for mobile app messaging here.

 

 

 

 

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”: “<your custom messaging service class name>” } To create a custom messaging service implementation, the customer should implement the SDK’s MessagingService interface.

    Sample code:

    import android.content.Context;
    
    import com.ibm.mce.sdk.api.MceSdkConfiguration;
    import com.ibm.mce.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"; }}
    

Expected outcome

Need more help? Check out all of our available tutorials for mobile app messaging here.

Join The Discussion

Your email address will not be published. Required fields are marked *