Support Topics Documentation Slack YouTube Blog

Set icon for push notification - Android

how can we assign push notification’s icon in android 5 or later ???

This question is not related to Backendless.

Try to google it. I guess that this link would be useful: https://developer.android.com/training/notify-user/build-notification.html
regards,
Alex

but what about that , that i’m sending it from sever code ???

Setting an icon is not about sending, but about creating a system notification on the device.
You create and configure notification on client using Android SDK, not Backendless. Backendless just helps you to send information to client from server or from another client. After receiving you’re able to get that info and create and customise the notification with Android SDK.

this is how we normally create a push notification (using GCM api)

data={
    "to" : "/topics/my_little_topic",
    "notification" : {
    "body" : messageBody,
    "title" : messageTitle,
    "icon" : "ic_cloud_white_48dp" /// HERE's MY ICON
    }
}

but in backendless what i’m doing is this :


PublishOptions publishOptions = new PublishOptions();
publishOptions.putHeader("android-ticker-text", "TICKER");
publishOptions.putHeader("android-content-title", "TITLE");
publishOptions.putHeader("android-content-text", "CONTENT"); //so do i have to set the icon  right here or i can do it inside my Android SDK ?

and if i have to configure the notification inside my android SDK then how i’m going to get the instance of notification which is sent by backendless ??

How do you handle the received notification on the client? Please provide the code you use in order to make sure that we’re on the same page.

i tired setting the header but its not working , and i’m just showing the received notification using the receivers in manifest

You’ll need to override 2 classes to customize the push notification, this is described in the doc here: https://github.com/Backendless/Android-SDK/blob/docs/docs/push.md

Note that in this case you’ll need to build the notification UI by yourself, the tutorial could be found here: https://developer.android.com/training/notify-user/build-notification.html
You can also view the default implementation in the default receiver class (method handleMessage): https://github.com/Backendless/Android-SDK/blob/master/src/com/backendless/push/BackendlessPushService.java

You can set the custom small icon for the push notification. Please follow the steps described here:

Best Regards,
Maksym