Setup project in the Firebase console and integrate it with your app.

Firebase integration instruction

Add FirebaseMessaging dependency to your app’s gradle file.

implementation 'com.google.firebase:firebase-messaging:17.6.0'

Enable FCM handling for SDK.

public class MyApp extends Application {

    @Override
    public void onCreate() {
        ProxiCloudSdk.create(getApplicationContext(), "API_KEY"); //init SDK as usual
        ProxiCloudSdk.getInstance().enableCloudMessaging();
    }
}

For SDK to access notification data you need to extend FirebaseMessagingService. We provide default implementation, but it has to be registered in the application’s manifest. Do it only if you don’t already extend this class as only one service will receive messages.

<service
    android:name="cloud.proxi.sdk.firebase.ProxiCloudFcmService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

If you already have your own implementation, pass received message to the SDK. It will recognize which messages should be handled.

public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        ProxiCloudSdk.getInstance().getFcmManager().handleMessage(remoteMessage);
    }    
}