Can we send the custom user info(Keys) while publishing a push notification? Is there any related documentation on it?
Hello, Aman!
Sure, you can. In order to do that you can put extra header to instance of PublishOptions class.
After that your BroadcastReceiver would be able to extract the value from intent.
For example:
PublishOptions options = new PublishOptions();
options.putHeader( "YOUR_CUSTOM_HEADER", "VALUE" );
Backendless.Messaging.publish....
…and your code in reciever:
public boolean onMessage( Context context, Intent intent )
{
String yourExtractedValue = intent.getStringExtra( "YOUR_CUSTOM_HEADER" );
}
please, notify me if you have any problems.
Alex Navara
Hi Alex
I know this is from a year ago, but since the Receiver OnMessage() is now replaced with PushService onMessage() so how we pull this off? because Push Service is not executing onMessage();
Hi Muhammad,
BackendlessPushService has exactly the same methods as former BroadcasrReceiver.
See more at https://github.com/Backendless/Android-SDK/blob/master/docs/push.md#receiving-pushes.
Regards, Artur