【问题标题】:Background location service notification has a blank notification small icon后台定位服务通知有空白通知小图标
【发布时间】:2021-01-27 10:42:56
【问题描述】:

我正在尝试构建一个使用颤振位置包不断获取用户位置的应用程序。

唯一的问题是,“后台定位服务正在运行”的通知在应用程序图标应该存在的地方有一个空白区域。

我收到 FCM 通知,图标显示和一切正常。

Picture showing blank icon Picture showing blank icon2

【问题讨论】:

    标签: android flutter notifications geolocation icons


    【解决方案1】:

    首先,您必须将 OAuth 同意书填写到谷歌云控制台中。在那里你可以设置应用程序的标志。

    https://console.cloud.google.com/apis/credentials/consent

    【讨论】:

    • 不是很有帮助。问题是相当局部的。
    • 您是否将您的图标添加到该同意书?
    【解决方案2】:

    问题出在插件本身。

    The part that must be changed in the android plugin

    我将 pub-cache 中的插件更改为:

    val notification: Notification = NotificationCompat.Builder(this, CHANNEL_ID)
                        .setContentTitle(getText(R.string.notification_title))
                        .setSmallIcon(R.drawable.navigation_empty_icon)
                        .setPriority(NotificationCompat.PRIORITY_HIGH)
                        .build()
    

    val notification: Notification = NotificationCompat.Builder(this, CHANNEL_ID)
                        .setContentTitle("You can change the title to whatever here")
                        .setSmallIcon("@mipmap/ic_launcher", "mipmap", packageName))
                        .setPriority(NotificationCompat.PRIORITY_HIGH)
                        .build()
    

    这将使标题和应用程序的图标相同

    【讨论】:

      【解决方案3】:

      在 4.3.0 版本中 ..\packages\location\android\src\main\java\com\lyokone\location\FlutterLocationService.kt

      从第 21 行更改

      const val kDefaultNotificationIconName: String = "navigation_empty_icon"
      

      const val kDefaultNotificationIconName: String = "@mipmap/ic_launcher"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-07-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多