【发布时间】:2021-10-21 21:44:37
【问题描述】:
当我收到来自 Firebase Cloud Messaging 的推送通知并且我的应用处于后台时,我会在 android 的系统状态栏中收到此通知。
但是,如果我的应用在后台,我不会收到它,而是会引发 onMessageReceived。
如果应用程序处于前台模式,是否可以显示此通知? 我知道我可以使用 NotifictionManager 并手动构建此通知,但如果应用程序在后台,Firebase SDK 应该有一种更简单的方法。喜欢
class FcmService: FirebaseMessagingService() {
override fun onMessageReceived(message: RemoteMessage) {
showNotificationInStatusbar(message)
}
【问题讨论】:
标签: android firebase push-notification firebase-cloud-messaging android-notifications