【发布时间】:2021-01-27 10:42:56
【问题描述】:
我正在尝试构建一个使用颤振位置包不断获取用户位置的应用程序。
唯一的问题是,“后台定位服务正在运行”的通知在应用程序图标应该存在的地方有一个空白区域。
我收到 FCM 通知,图标显示和一切正常。
【问题讨论】:
标签: android flutter notifications geolocation icons
我正在尝试构建一个使用颤振位置包不断获取用户位置的应用程序。
唯一的问题是,“后台定位服务正在运行”的通知在应用程序图标应该存在的地方有一个空白区域。
我收到 FCM 通知,图标显示和一切正常。
【问题讨论】:
标签: android flutter notifications geolocation icons
首先,您必须将 OAuth 同意书填写到谷歌云控制台中。在那里你可以设置应用程序的标志。
【讨论】:
问题出在插件本身。
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()
这将使标题和应用程序的图标相同
【讨论】:
在 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"
【讨论】: