Support Topics Documentation Slack YouTube Blog

Extend BackendlessFCMService and get header values

If I extend the BackendlessFCMService

public class NotificationService extends BackendlessFCMService

I am receiving notification successfully in

    public boolean onMessage(Context appContext, Intent msgIntent) {

but if I send a push notification in the console and add a custom header with value how can I retrieve that value?

Similar to this post BackendlessFCMService where they get


but I want to get the header values not the publish options

Are you using PushTemplates or jsut making Backendless.Messaging.publish()?

    PublishOptions publishOptions = new PublishOptions();
    publishOptions.setHeaders( <hashmap with headers> );
    Backendless.Messaging.publish( "channel", "message text", publishOptions );

then you can do the following in the code on the device


Also make sure that you use latest Android-SDK.

Hi I was testing using PushTemplates.

That was easy
msgIntent.getStringExtra("custom_header_name") worked.

Many thanks

Please, take into account that now only headers with smart-text (if we are talking about Push Templates) can be retrieved with msgIntent.getStringExtra("custom_header_name").
I suppose, the fix will be made till the end of this week.

Ah, to confirm - if the header doesn’t have smart-text I cannot use msgIntent.getStringExtra("custom_header_name")

I am not intending on using smart-text in the header so how else then could I get the value of a header if it does not contain smart-text? (Yes talking about Push Templates)

Unfortunately, you should wait the fix.

Thats fine I don’t mind waiting - I think we have crossed wires - so the fix will allow for this, I thought you meant the other way around - the fix will prevent this?

You are right – “the fix will allow for this”.

1 Like