我为推送通知设置了一个很棒的通知包,我使用Firebase消息服务,在iOS上一切正常,但对于Android,我有一个问题,当我使用活动测试向Android设备发送通知时,它工作正常,当应用程序在后台时,我收到了通知,问题是当我从应用程序发送通知时,Android设备没有收到,以下是我用来发送通知的代码。
Future<void> sendAndroidNotification(
authorizedSupplierTokenId, serviceName) async {
try {
http.Response response = await http.post(
Uri.parse(messageAndroidUrl),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'key=$messageKey',
body: jsonEncode(
<String, dynamic>{
'notification': <String, dynamic>{
'body': serviceName,
'title': 'Nueva Solicitud',
'priority': 'high',
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
'id': '1',
'status': 'done'
'to': authorizedSupplierTokenId,
'token': authorizedSupplierTokenId
response;
} catch (e) {
var messageAndroidUrl = "https://api.rnfirebase.io/messaging/send"; 我从firebase_messaging pub包的例子中得到这个Url,但我也试过这个URL "https://fcm.googleapis.com/fcm/send";这是一个适用于iOS的URL,所以谁能帮帮我?