If you would like to have your own push receiver to handle all the push messages coming from Blueshift and other channels who use FCM, you need to override the FCM implementation done by the Blueshift Android SDK. This is required if you want to get callback when FCM token changes.
Note: This change requires SDK version 2.0.2 or above
Override BlueshiftMessagingService
public class YourMessagingService extends BlueshiftMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
/*
* It is important to keep the super.onMessageReceived()
* call if you want the SDK to do the notification rendering
* for push messages coming from the Blueshift server.
* If you want to completely override the notification rendering,
* skip this call and implement your code. */
super.onMessageReceived(remoteMessage);
}
@Override
public void onNewToken(String newToken) {
super.onNewToken(newToken);
/*
* Use the new token in your app. the super call is important
* for the SDK to do the analytical part and notification
* rendering. Make sure that it is present when you override
* onNewToken() method.
*/
}
}
Update AndroidManifest.xml
<service
android:name="your.package.name.YourMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>