This issue typically occurs on Android when your application uses another Firebase Cloud Messaging (FCM) service in addition to the Pushwoosh SDK. If another service intercepts a Pushwoosh notification first, it may not know how to parse the content, resulting in a blank push being displayed.
When multiple FirebaseMessagingService implementations are present in an app, you must ensure Pushwoosh notifications are processed by the Pushwoosh SDK. You can resolve this in one of two ways.
1. Set service priority
Ensure that the Pushwoosh service has the highest priority in your AndroidManifest.xml, so the Pushwoosh SDK processes its notifications before any other service. Add the tools:node="replace" attribute and set a high priority for the com.pushwoosh.firebase.PushFcmIntentService intent-filter, for example 100:
<service android:name="com.pushwoosh.firebase.PushFcmIntentService" android:exported="false">
<intent-filter android:priority="100" tools:node="replace">
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
2. Implement a routing service
A more robust method is to create a single “router” service that receives all FCM messages and forwards them to the appropriate SDK. This prevents conflicts and ensures each push provider processes its own payloads.
Your router service should:
- Extend
FirebaseMessagingService. - In
onMessageReceived, check whether theRemoteMessagecame from Pushwoosh withPushwooshFcmHelper.isPushwooshMessage(remoteMessage), and if so hand it to the SDK withPushwooshFcmHelper.onMessageReceived(getApplicationContext(), remoteMessage). Otherwise pass it to your other push provider's logic. - In
onNewToken, forward the token to Pushwoosh withPushwooshFcmHelper.onTokenRefresh(token)in addition to your other provider.
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (PushwooshFcmHelper.isPushwooshMessage(remoteMessage)) {
PushwooshFcmHelper.onMessageReceived(getApplicationContext(), remoteMessage);
} else {
// handle messages from your other push provider
}
}
@Override
public void onNewToken(String token) {
PushwooshFcmHelper.onTokenRefresh(token);
}
}
For detailed instructions and code examples, see our documentation: Using Pushwoosh SDK with other FCM services.
Comments
0 comments
Please sign in to leave a comment.