JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
87 stars 49 forks source link

Notification icon - Release build #42

Open ChathuraHettiarachchi opened 3 years ago

ChathuraHettiarachchi commented 3 years ago

This was strange. I tested the application on debug mode and the icon I'm providing is getting displayed correctly. But when tested with release build after flutter clean, icon just showing grey squre.

static final androidConfig = FlutterBackgroundAndroidConfig(
      notificationTitle: NOTIFICATION_TITLE,
      notificationText: NOTIFICATION_TEXT,
      notificationImportance: AndroidNotificationImportance.Default,
      notificationIcon:
          AndroidResource(name: "ic_app", defType: 'mipmap'));
Alystrasz commented 3 years ago

Hello @ChathuraHettiarachchi,

Your problem is not linked to flutter_background package, but rather to your icon files. Android notification icons should not feature other colors than white (you can still include some alpha).

Check out https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/ for more details!

PeterNjeim commented 2 years ago

I'm facing the same issue. The icon appears properly in debug mode, but does not appear properly in release mode. My icon is white with some slightly transparent white areas. So I decided to test with a pure white icon, either fully opaque or fully transparent pixels, same thing. If it was truly an icon issue, it wouldn't work in either debug mode or release mode, something else is happening here.

victor-semenovich-dev commented 2 years ago

I also have the same problem. The icon is not displayed in the release mode.

webasoo commented 2 years ago

generate drawer resource and then : AndroidResource( name: '@drawable/ic_launcher_foreground', defType: 'drawable')

(ic_launcher_foreground is name of my icon)