【发布时间】:2021-07-21 23:19:25
【问题描述】:
我开发了一款应用,手机锁定时无法收到 FCM 通知。
_fcm.configure(
onMessage: (Map<String, dynamic> message) async {
print("onMessage: $message");
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 100,
channelKey: "basic_channel",
title: message['notification']['title'],
body: message['notification']['body'],
showWhen: true,
autoCancel: true));
},
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
},
);
我使用 firebase 和 Awesome Notification 插件来显示通知。
使用的包:firebase_messaging:^7.0.3
下面是我展示的代码
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
final pushNotificationService = PushNotificationService(_firebaseMessaging);
pushNotificationService.initialise();
}
}
谁能帮帮我,我卡在这里 谢谢
【问题讨论】:
-
您可以尝试将优先级设置为高,看看是否有帮助
-
发布适当的代码,例如用于 FCM 的库、已初始化 fcm 接收器的类等
-
@Quicklearner 我更新了问题,如果有帮助请告诉我
标签: android flutter push-notification firebase-cloud-messaging