I have built a flutter app that uses custom notification icons on Android. When I build my app locally using vscode, and test it on a real device (Pixel 6a), the notification icons work. Here's a screenshot that illustrates what I'm talking about.
However, when I use Codemagic to push my app to the Google Play Store, then install the app from the Play Store, the icons disappear. I'm using the same Pixel 6a.
Here's a screenshot showing the missing icons.
My guess is that this has something to do with how Codemagic compiles the app, but I don't appear to have a lot of control over that.
Finally, I'm using the awesome_notifications package to send these notifications locally. Here's the code that references the icon.
AwesomeNotifications().initialize(
'resource://drawable/ic_stat_awair_android_icons',
[
NotificationChannel(
channelKey: 'scheduled_channel',
channelName: 'awair Notifications',
importance: NotificationImportance.High,
channelDescription: 'awair Notification Channel',
),
NotificationChannel(
channelKey: 'basic_channel',
channelName: 'awair basic Notifications',
channelDescription: 'awair Notification Channel',
),
],
);
Can anyone help me solve this issue?
Thanks,
Chris
CodePudding user response:
Verify that the background of the icons you add is transparent.
Verify that you have added icon packs for all screen sizes.
CodePudding user response:
When creating the release apk, some png file might be processed or removed by R8 compiler which make them broken. You can select which files to keep in your code. Goto android/app/src/main/res/raw/keep.xml
. If the file does not exist then create it. Inside it you can specify which files to keep as follows
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/ic_notification"
/>
You can read more about it here https://developer.android.com/studio/build/shrink-code#keep-resources