Push notifications

To enable message push notifications you must first configure Firebase Cloud Messaging (FCM) in your project. If you haven’t done this yet see how to add Firebase to your project.

To begin integrating the Delivered Firebase push service, add the following dependency to your app/build.gradle file:

dependencies {
    ...
    
    compile 'im.delivered.sdk:fcm-extension:0.+'
}

Next, you must use the DeliveredFcmService and DeliveredFcmIdService classes provided by the Delivered SDK. These classes extend the FirebaseInstanceIdService and FirebaseMessagingService classes respectively. If you already extend these classes in your project, replace the superclass with the Delivered versions making sure you call the respective super methods.

To implement the DeliveredFcmIdService and DeliveredFcmService use the following snippets:

public class MyFcmIdService extends DeliveredFcmIdService {

    @Override
    public void onTokenRefresh() {
        super.onTokenRefresh();

        // Get updated InstanceID token.
        String refreshedToken = FirebaseInstanceId.getInstance().getToken();

        // If you want to send messages to this application instance or
        // manage this apps subscriptions on the server side, send the
        // Instance ID token to your app server.

        ...
    }
}
public class MyFcmService extends DeliveredFcmService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        // Your custom push handling here if needed
        
        ...
    }
}

Once the configuration is completed you should be able to receive push notifications.