相关疑难解决方法(0)

尝试在 Firebase Cloud Functions 中使用 Firebase Cloud Messaging 发送推送通知时未找到请求的实体

我正在尝试使用以下代码通过 FCM 从 Firebase Cloud 函数发送多播通知:

const message = {
    tokens: recipients,
    notification: {
        title: title,
        body: body
    },
    data: {
        projectPartnerId: projectPartnerId
    }
};
return admin.messaging().sendMulticast(message);
Run Code Online (Sandbox Code Playgroud)

并且没有发送任何推送通知。每个响应都包含一个带有相同消息的错误:“未找到请求的实体”。

我在 Google Cloud 控制台中启用了 API(Firebase 文档中没有提到它,但显然这是必要的)。我不知道我还能做什么。我能找到的所有其他问题都与 HTTP API 或遗留 API 相关。我使用的是最新版本的 Firebase Admin SDK。

firebase firebase-cloud-messaging firebase-admin

21
推荐指数
2
解决办法
3万
查看次数

发送推送通知时出现“错误”:“ InvalidRegistration”

我正在使用FirebasePushNotificationPlugin中实现FCM推送通知 Xamarin.Forms。在iOS项目中,AppDelegateRegisteredForRemoteNotifications方法调用deviceToken生成时,但是当我发送token由邮递员生成的通知时,出现错误。

{“ multicast_id”:8631208504861228784,“ success”:0,“ failure”:1,1,“ canonical_ids”:0,“ results”:[{“ error”:“ InvalidRegistration”}]}

这是我AppDelegate这里得到的代码:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    FirebasePushNotificationManager.Initialize(options, new NotificationUserCategory[]
    {
        new NotificationUserCategory("message",new List<NotificationUserAction> {
            new NotificationUserAction("Reply","Reply",NotificationActionType.Foreground)
        }),
        new NotificationUserCategory("request",new List<NotificationUserAction> {
            new NotificationUserAction("Accept","Accept"),
            new NotificationUserAction("Reject","Reject",NotificationActionType.Destructive)
        })
    });

    return base.FinishedLaunching(app, options);
}

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
    FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
    Console.WriteLine("Token- - - :  "+deviceToken);
}

public override void …
Run Code Online (Sandbox Code Playgroud)

xamarin.ios ios xamarin xamarin.forms firebase-cloud-messaging

8
推荐指数
1
解决办法
631
查看次数

FCM 推送通知:MismatchSenderId

再会,

我正在尝试使用 FCM 中的此 URL 来发送消息:

https://fcm.googleapis.com/fcm/send

标题为

    Authorization value of **key:*Key from Firebase Console***
    Content-Type: **application/json**
Run Code Online (Sandbox Code Playgroud)

主体由以下部分组成:

    {
       "to" : "MyKey generated",
       "notification" : {
       "body" : "Hey",
       "title" : "Hey"
    }  
 }
Run Code Online (Sandbox Code Playgroud)

但我总是收到的结果是这样的:

     {
        "multicast_id": 7942550122547405787,
        "success": 0,
        "failure": 1,
        "canonical_ids": 0,
        "results": [
            {
               "error": "MismatchSenderId"
           }
      ]
    }
Run Code Online (Sandbox Code Playgroud)

我得到的服务器密钥来自这里:

服务器密钥

我的 URL 参考是 FCM 服务器中的文档。

我正在邮差中测试这个。我错过了什么?谢谢

android push-notification firebase google-cloud-messaging firebase-cloud-messaging

3
推荐指数
1
解决办法
3万
查看次数