Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set a background color for the icon in the notification drawer on Android if using Parse Push?

Is it possibile to change the background color for the icon in the notification in the notification drawer on Android if using Parse Push?

I'm talking about the background color for the circle you can take a look at from the image below

Thanks in advance,

Adriano

Notifications in the notification drawer

like image 293
Adriano Di Giovanni Avatar asked Mar 11 '15 10:03

Adriano Di Giovanni


People also ask

Can you change the color of notification icons on android?

If you want to change the color of your notification bar, you can download an application called “One shade” from Play Store and follow these steps: Open the One shade app and toggle on > Tap “colors.” Choose “Background color” > Set a color by sliding the bar on the right > Apply.

How do I change the background color on my notifications?

call setColor -> the color to be used on the background. call setColorized -> the actual call to set the background color. set style to NotificationCompat. DecoratedMediaCustomViewStyle()

How do I change notification icons on Android?

1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.


1 Answers

I think you can use the following method:

  1. Implement a custom ParsePushBroadcastReceiver
  2. Override getNotification(Context context, Intent intent)
  3. Set notification color

Here's an example of how I did it:

public class PushBroadcastReceiver extends ParsePushBroadcastReceiver {

    @Override
    protected Notification getNotification(Context context, Intent intent) {
        Notification notification = super.getNotification(context, intent);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            notification.color = context.getResources().getColor(R.color.your_background_color);
        }
        return notification;
    }
}
like image 150
alonsovb Avatar answered Sep 28 '22 09:09

alonsovb