相关疑难解决方法(0)

FCM with Postman - 请求缺少身份验证密钥(FCM令牌)

在此输入图像描述

//身体就像这样

{
    "to":
    "/topics/NEWS"
    ,
    "data":{
        "extra_information": "This is some extra information"
    },
Run Code Online (Sandbox Code Playgroud)

//我需要提供的通知

"notification":{
            "title": "ChitChat Group",
            "text": "You may have new messages",
            "click_action":"ChatActivity"
        }
    }
Run Code Online (Sandbox Code Playgroud)

firebase postman firebase-cloud-messaging

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

FCM(Firebase云消息传递)发送到多个设备

我执行此代码以使用FCM库将通知推送到移动设备

public string PushFCMNotification(string deviceId, string message) 
    {
        string SERVER_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxx";
        var SENDER_ID = "xxxxxxxxx";
        var value = message;
        WebRequest tRequest;
        tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");
        tRequest.Method = "post";
        tRequest.ContentType = "application/json";
        tRequest.Headers.Add(string.Format("Authorization: key={0}", SERVER_API_KEY));

        tRequest.Headers.Add(string.Format("Sender: id={0}", SENDER_ID));

        var data = new
        {
            to = deviceId,
            notification = new
            {
                body = "This is the message",
                title = "This is the title",
                icon = "myicon"
            }
        };

        var serializer = new JavaScriptSerializer();
        var json = serializer.Serialize(data);

        Byte[] byteArray = Encoding.UTF8.GetBytes(json);

        tRequest.ContentLength …
Run Code Online (Sandbox Code Playgroud)

asp.net android firebase-cloud-messaging

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

FCM - 以编程方式将推送通知发送到用户段

我可以从Firebase控制台向单个设备,主题和用户细分发送通知.

我想将推送通知发送到用户段.我搜索了很多,但我只是通过脚本向单个用户或主题发送通知而不是用户段.

我尝试了下面的代码

var client = new RestClient("https://fcm.googleapis.com/fcm/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "key=mykey");
request.AddParameter("application/json", "\n\n{\"to\" : \"user-segment-name\",\n\"notification\" : {\n    \"body\" : \"test message\",\n    \"title\" : \"Portugal vs. Denmark\"\n    },\n    \"priority\":\"high\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Response.Write(response.Content); 
Run Code Online (Sandbox Code Playgroud)

我收到的答复如下

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

javascript ios firebase firebase-cloud-messaging

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

如何通过HTTP向观众发送firebase通知

在Firebase控制台中,我根据各种用户属性设置了受众群体,现在可以通过控制台向不同的用户群体发送通知.是否有办法通过http请求fcm服务器执行相同的操作?"to"字段应该有一个技巧,但我无法理解.

firebase firebase-cloud-messaging firebase-notifications

7
推荐指数
1
解决办法
3897
查看次数