Skip to content

Handle null messageId when using multiple GCM receivers #132

@tehmaestro

Description

@tehmaestro

Hi, so I have an app that was multiple push providers. Let's assume I have Parse and Firebase together.
The issue I'm having is that when sending push messages from Parse, there are two notifications displayed. I believe this is due to the onMessageReceived being called, although the push message was not sent through Firebase.
I also observed that remoteMessage.getMessageId is always null, when the push messages are NOT sent with firebase. Would it be safe to assume that when id is null, the messages are sent through some other push gcm receiver, like Parse, and the push should not be handled by firebase onMessageReceived ?
What do you think? Is it ok to return here:

        if(TextUtils.isEmpty(id)){
           return; // Message not sent through firebase have the ID null, so the message should be handled by other receivers
            Random rand = new Random();
            int  n = rand.nextInt(50) + 1;
            id = Integer.toString(n);
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions