Flutter - 仅在 Android 中使用音频服务的锁定屏幕窗口图标存在问题

问题描述 投票:0回答:2

我使用音频服务来允许音频文件在后台播放。除了锁定屏幕中的图标外,一切正常(仅限 Android,iOS 正常)。 在文档中我找不到如何实现它。为了通过推送通知实现个人图标,我使用 AndroidManifest.xml。但在这里我不知道该怎么做。 下面我展示了窗口如何导致锁定屏幕。 我感谢您的帮助。

flutter audio background audio-service
2个回答
0
投票

可以通过传入

androidNotificationIcon
AudioServiceConfig
中的
init
设置来设置图标。它记录在here

String androidNotificationIcon

Android 媒体通知中使用的图标资源,指定为 XML 资源引用。这应该是透明背景上的单色白色图标。默认值为

"mipmap/ic_launcher"

如果您已经使用此选项来设置图标,但您的图标未正确呈现,可能是因为您提供的图标不符合单色要求。


0
投票

除了 Ryan 提到的所有内容之外,我还必须将以下内容添加到 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...
© www.soinside.com 2019 - 2024. All rights reserved.