Gurcan
Gurcan

Reputation: 438

Android Firebase FirebaseMessagingService RemoteMessage Priority

I'm using FirebaseMessagingService for having remote messages. Normally, my code works properly but if the android device sleeps, sometimes messaging service doesn't work. I doubt that there can be any priority problems with my messages. My NodeJs code below.

...
    const data = {
        data: {
            param1: valueObject.param1,
            param2: valueObject.param2,
            pushId: event.params.pushId
        }
    };
   const options = {
        priority: "high",
        timeToLive: 0  
    };
return admin.messaging().sendToTopic("MyTopic", data, options);

I think my request should be the high priority but, just in case, I want to check this in my onMessageReceived() method. Do I have a chance to see the priority of the RemoteMessage?

I can see that the getPriority() method in the below document but I cannot have it in my debug screen.

https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/RemoteMessage.html#getPriority()

Any advice or guidance would be greatly appreciated..!!

Upvotes: 0

Views: 554

Answers (1)

user1407621
user1407621

Reputation: 11

I had the same Problem, just read the keys from Bundle:

remoteMessage.mBundle.keySet()

you will get keys, two of them are:

"google.delivered_priority"
"google.original_priority"

and take the values:

remoteMessage.mBundle.get("google.delivered_priority")

you will get the priority.

Upvotes: 1

Related Questions