gafsel / flutter_plugin_playlist

A Flutter plugin for Android and iOS with native support for audio playlists, background support, and lock screen controls
MIT License
23 stars 8 forks source link

How to change icon of notification? #4

Closed phimath closed 5 years ago

phimath commented 5 years ago

The default icon in the media notification is the Flutter logo. How do you go about changing this?

thanks

gafsel commented 5 years ago

Hi @phimath

You can change the icon by adding the new one at res/mipmap/icon.png.

phimath commented 5 years ago

Thanks, figured out though that its res/mipmap/ic_launcher.png that changes it if you want to update the docs to reflect.

gafsel commented 5 years ago

I revised the source code and find out that it expects mipmap/icon and if it is not found, the mipmap/ic_laucher is requested, as shown below:

private int getMipmapIcon() {
    // return R.mipmap.icon; // this comes from cordova itself.
    if (notificationIconId <= 0) {
        notificationIconId = fakeR.getId("mipmap", "icon");
        // API 28 moves the reference to this.
        if (notificationIconId <= 0) {
            notificationIconId = fakeR.getId("mipmap", "ic_launcher");
        }
    }
    return notificationIconId;
}

I'll change the plugin so it can receive any chosen name.