Android.setColor for big icon

I wanted to ask if there is a way to set the notification color with .setColor from .setLargeIcon ? Because as soon as I use .setSmallIcon and .setLargeIcon , my color is used for a small icon. I wanted to present my individual notification icon using LargeIcon and the application icon from which the notification was called using the small icon.

Example:

 Bitmap maintenanceIcon = BitmapFactory.decodeResource(getResources(),R.drawable.maintenance); Intent replacePumpIntent = new Intent(this, FoodListActivity.class); PendingIntent replacePumpPendingIntent = PendingIntent.getActivity(this,0,replacePumpIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder maintenanceBuilder = new NotificationCompat.Builder(this) .setLargeIcon(maintenanceIcon) .setSmallIcon(R.drawable.app) .setContentTitle("Maintenance: ") .setColor(getResources().getColor(R.color.alertMaintenance)) .setContentText(Html.fromHtml(getString(R.string.alert_maintenance_message))) .setLights(Color.YELLOW, 500 , 500) .setVibrate(new long[] { 100, 250, 100, 250, 100, 250 }) .setPriority(0x00000001) .setStyle(new NotificationCompat.BigTextStyle() .bigText(Html.fromHtml(getString(R.string.alert_maintenance_message)))) .addAction(R.drawable.ic_arrow_right_black, getString(R.string.alert_maintenance_button_1),replacePumpPendingIntent ); NotificationManager maintenanceNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); maintenanceNotificationManager.notify(3, maintenanceBuilder.build()); 
+6
source share
2 answers

this will help you remove the gray color from the notification icon

  Notification notification = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.ic_launcher) .setContentText("Simple description of something meaningful") .setContentTitle("Yo check this out") .setColor(context.getResources() .getColor(R.color.brand_color)) .build(); NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(SINGLE_NOTIFICATION_ID, notification); brand_color is defined as #FF0066CC. 

A source

+2
source

According to this: fooobar.com/questions/34220 / ...

Unable to change background Large icon if both are present. A large icon should not be transparent.

+1
source

Source: https://habr.com/ru/post/978331/


All Articles