【发布时间】:2020-07-13 23:00:27
【问题描述】:
在我的 Flutter 应用程序中,推送通知适用于 Android,但对于 IOS 我没有收到通知警报,但它会打印来自 onMessage 方法的控制台通知。
以下是我的命令和输出。
curl -X POST --header "Authorization: key=<API_KEY>" \ --Header "Content-Type: application/json" \ https://fcm.googleapis.com/fcm/send \ -d "{\"to\":\"<DEVICE_TOKEN>\",\"notification\":{\"body\":\"Testing\"},\"priority\":10}"
IOS 的输出是:
{"multicast_id":9037043763539529381,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:158620223403259%62c34b3562c38b95"}]}
以下是收到通知时执行的代码块。
_firebaseMessaging.configure(
onBackgroundMessage: null,
onMessage: (Map<String, dynamic> message) async {
// app int he foreground
print('This works on IOS and Android both');
},
onResume: (Map<String, dynamic> message) async {
// App is in the background
print('This works on IOS and Android both');
// But no notification alert shown to the user to click (android everything works fine)
},
onLaunch: (Map<String, dynamic> message) async {
// app terminated
print('This works on IOS and Android both');
// But no notification alert shown to the user to click But no notification alert shown to the user to click (android everything works fine)
},
);
任何帮助将不胜感激...
【问题讨论】:
标签: iphone flutter firebase-notifications