4

In my application i have used parse cloud code for sending push notifications to user.By default notification icon used app icon.but I want to change notification icon . I used this below code in manifest xml

<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/noti_icon"/>

But the icon will not change. Any way to achieve this??

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
Surya
  • 101
  • 2
  • 6

4 Answers4

7

The official way to change the Android push notification icon when receiving push notifications using Parse, as stated in the Parse Android docs for push notifications is as follows:

enter image description here

IMPORTANT
Make sure the image that you want to use follows the Icon Reference Chart section for Notification icons - specifically:

They should be flat (no gradients), white and face-on perspective

If your icon violates one of these requirements, your icon will show as a white box.

DiscDev
  • 38,652
  • 20
  • 117
  • 133
  • 2
    Doesn't work for me. It always show a white box in my status bar. – Bagusflyer Jun 26 '15 at 03:16
  • @bagusflyer you must have missed that your icon is required to be flat with no gradients, which is why it shows as white. Please read the full answer and it will work as expected. – DiscDev Nov 06 '15 at 20:21
2

In PushService, each of the setDefaultPushCallback() and subscribe() methods allows an extra parameter to specify the icon:

PushService.setDefaultPushCallback(context, SomeActivity.class, R.drawable.customIcon)

PushService.subscribe(context, "ChannelName", SomeActivity.class, R.drawable.customIcon)
AAEM
  • 1,837
  • 2
  • 18
  • 26
Born To Win
  • 3,319
  • 3
  • 19
  • 27
1

Write the line below to Manifest;

<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/pushicon"/>

Please use 88X88 white image in 96X96 canvas.

Here is icon; It's white. (!)

enter image description here

Here is result

enter image description here

Göksel Güren
  • 1,479
  • 13
  • 21
  • When I use this icon in my cordova project the aapt tool will remove the alpha channel before packaging the png. Any idea why that is? – philk Jun 17 '16 at 23:05
-1

Or you could have just uploaded an Image on Parse.com under Settings and then Icon Image.