Trying to get back header and notification values in the overrideable onMessage method in class that extends BackendlessFCMService
I can retrieve the message with:
msgIntent.getStringExtra(“message”)
but am having trouble getting the title
I tried msgIntent.getStringExtra(“content-title”) but getting null
I am also using a custom header called message_id in the template and I cannot get this data back either
I tried msgIntent.getStringExtra(“message_id”) - again getting null
OK I am having lots of problems on the Android side of push.
All I want to do really is have a mechanism of telling the push notification on android to go to a different activity when the push notification is clicked upon.
So I tried a couple of things.
overriding the onMessage method in a class which exends BackendlessFCMService and try and change the intent of the notification, but I can’t get this to work. It doesn’t seem to change the destination activity, it makes no difference
This is where I noticed that I can’t get the header values in this method. Update on this, I can get the header values if they are set with smartText in the template composer. This jogged my memory - It seems to be what we figured out a long time ago and maybe it isn’t fixed yet?! See:
I can however pick up the header values as the main activity loads on a push notification click. Really weird thing is that sometimes it picks up old push notifications which have been sent. I just don’t get that, maybe that is just a weird developer phone bug. The messages I get in the onMessage method are always the correct ones.So I don’t think I want to rely on this method either!
Please please, all I really want to solve is how to change the activity which the push notification will go to when the notification is clicked. I can’t use the buttons option.
Any help appreciated as been stuck on this for ages now!
sometimes it picks up old push notifications which have been sent
It means that notification’s extras are not updated when a new notification comes.
You should read more about building the notification. Take a look at PendingIntent options (notificationID and PedingIntent flags: PendingIntent | Android Developers)
Please take into account that some constants from PublishOptions was used in the previous implementations of our messaging.
The new one is Push Templates.