You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
I'm using react-native-push-notification along with Localytics push messaging. So I created a custom FirebaseMessagingService that checks if RemoteMessage is a Localytics message else it needs to fire RNPushListenerService.
I'm starting RNPushListenerService using startService but it does not look like it is starting it. Has anyone else dealt with issue like this before? and How did you handle it?
Note: There can only be one FirebaseMessagingService with intent-filter of com.google.firebase.MESSAGING_EVENT and I'm registering my custom service with that intent-filter.
public class CustomFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> data = remoteMessage.getData();
try {
if (!Localytics.handleFirebaseMessage(data)) {
forwardPushNotification(remoteMessage);
}
} catch (Exception e) {
Timber.e(e, "Failed to extract Push Message", remoteMessage.getMessageId());
}
}
@Override
public void onNewToken(String token) {
super.onNewToken(token);
Localytics.setPushRegistrationId(token);
}
private void forwardPushNotification(RemoteMessage remoteMessage) {
Map<String, String> data = remoteMessage.getData();
data.put("from", remoteMessage.getFrom());
Intent intent = new Intent(this, RNPushNotificationListenerService.class);
intent.setAction("com.google.firebase.MESSAGING_EVENT");
Bundle extraData = new Bundle(data.size());
for (Map.Entry<String, String> entry : data.entrySet()) {
extraData.putString(entry.getKey(), entry.getValue());
}
intent.putExtras(extraData);
startService(intent);
}
}
I think react-native-push-notification library needs to provide a custom method like the one Localytics is providing to handle these notifications when the user has multiple push providers. e.g. Localytics.handleFirebaseMessage
I'm using react-native-push-notification along with Localytics push messaging. So I created a custom FirebaseMessagingService that checks if RemoteMessage is a Localytics message else it needs to fire
RNPushListenerService.I'm starting RNPushListenerService using startService but it does not look like it is starting it. Has anyone else dealt with issue like this before? and How did you handle it?
Note: There can only be one FirebaseMessagingService with intent-filter of
com.google.firebase.MESSAGING_EVENTand I'm registering my custom service with that intent-filter.I think react-native-push-notification library needs to provide a custom method like the one Localytics is providing to handle these notifications when the user has multiple push providers. e.g.
Localytics.handleFirebaseMessage