csacchetti
csacchetti

Reputation: 93

Flutter - Problem with Lock screen window icon with Audio Service in Android only

I use Audio Service to allow audio files to play in the background. Everything works fine except for the icon in the Lock screen (Android only, iOS work fine). In the documentation I couldn't find how to implement it. To implement personal icons with push Notifications I use AndroidManifest.xml. But here I don't know how I can do it. I show below how the window results in the Lock screen. I thank you for any help.

The icon is a circle black

Upvotes: 2

Views: 584

Answers (2)

Fabio Chen
Fabio Chen

Reputation: 1

In addition to all Ryan mentioned, I had to add the following to AndroidManifest.xml:

    <application
    android:name="com.your.package.Application"
    android:label="YourAppName"
    android:icon="@mipmap/launcher_icon">
            
    <!-- include meta-data... -->
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="location/of/notification_icon" />
    
    <activity...

Upvotes: 0

Ryan Heise
Ryan Heise

Reputation: 2786

The icon can be set via the androidNotificationIcon setting in the AudioServiceConfig you pass into init. It is documented here:

String androidNotificationIcon

The icon resource to be used in the Android media notification, specified like an XML resource reference. This should be a monochrome white icon on a transparent background. The default value is "mipmap/ic_launcher".

If you are already using this option to set the icon but your icon is not rendering correctly, it is probably because the icon you supplied did not follow the monochrome requirement.

Upvotes: 0

Related Questions