firebase - Firebase 推送通知突然停止在 Flutter 应用程序中工作
问题描述
我的颤振应用程序在两者上都正确接收了firebase推送通知iOS
,Android
但是今天,出乎意料的是,它停止接收推送通知,尽管通过发送推送的响应cURL
返回了成功消息。我正在按照FlutterFire
指南实施 Firebase 推送通知。应用程序在前台和后台模式下均未收到推送。
以下是我function
的几个小时前工作得很好。
Future<void> _configureFcm() async {
_firebaseMessaging = FirebaseMessaging.instance;
_userLoginModel = await Others.getUserLoginStatus();
_subscription = _firebaseMessaging.onTokenRefresh.listen((token) async {
_firebaseHelper.saveTokenToFirebaseServer(
token,
_userLoginModel.userId,
widget._userType,
);
});
_firebaseHelper.saveTokenToFirebaseServer(
await _firebaseMessaging.getToken(),
_userLoginModel.userId,
widget._userType,
);
await _firebaseMessaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
print('received notification');
});
}
常见问题
- 这个功能以前有效吗?==> 是的,是的
- 您是否对与通知相关的任何代码进行了任何更改?==> 不,事实上我根本没有对我的代码进行任何更改
- 你试过真机吗?==> 是的,我尝试过真实的
Android
设备iOS
,它们以前工作得很好,但现在不行了 - 您是否检查了与 Firebase 应用程序的连接?==> 是的,我做到了,Cloud Firestore 和 Auth 等其他服务运行良好
- 你试过了
flutter clean
吗?==> 是的,我做到了
解决方案
推荐阅读
- bash - JQ 选择和传递参数
- regex - POSIX 正则表达式中的环视以匹配除最后一个之外的所有空格(对于 gsub)
- c# - 返回元组时将 foreach 转换为变量分配
- reactjs - 填充所有值后如何自动调用函数
- java - Maven没有下载依赖项
- php - PHP 7.4.1 - PECL 不工作(尝试访问第 181 行 PEAR/REST.php 中 bool 类型值的数组偏移量)
- amazon-redshift - 如何计算红移中的MTD
- python - 打开文件从文件中删除行
- excel - 避免在excel的列中粘贴重复的一组值
- vim - 检测缓冲区是否在状态行的非活动窗口中