Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 确认收到firebase消息_C#_Firebase_Firebase Cloud Messaging - Fatal编程技术网

C# 确认收到firebase消息

C# 确认收到firebase消息,c#,firebase,firebase-cloud-messaging,C#,Firebase,Firebase Cloud Messaging,我有一个c#项目,通过http post向拥有ios和android的客户端发送firebase消息 客户端卸载我的应用程序时,他们的firebase设备ID不会从我的数据库中删除 下次我向与卸载我的应用程序的用户对应的设备id发送消息时,当然不会发送消息。 有没有办法知道消息是否未送达? 不幸的是,即使消息没有传递,响应也总是成功的 我当前的代码: var firebaseMessage = new FirebaseMessage(); firebaseMessage.data = notif

我有一个c#项目,通过http post向拥有ios和android的客户端发送firebase消息

客户端卸载我的应用程序时,他们的firebase设备ID不会从我的数据库中删除

下次我向与卸载我的应用程序的用户对应的设备id发送消息时,当然不会发送消息。 有没有办法知道消息是否未送达? 不幸的是,即使消息没有传递,响应也总是成功的

我当前的代码:

var firebaseMessage = new FirebaseMessage();
firebaseMessage.data = notificationMessages;
firebaseMessage.to = device.DeviceRegistrationId; <-- maybe this device is no longer valid
firebaseMessage.priority = "high";
firebaseMessage.notification = new ExpandoObject();
firebaseMessage.notification.title = "myApp";
firebaseMessage.notification.body = "testMessage";
firebaseMessage.notification.sound = "default";
firebaseMessage.notification.click_action = "FCM_PLUGIN_ACTIVITY";
firebaseMessage.notification.icon = "fcm_push_icon"; 
firebaseMessage.notification.delivery_receipt_requested= true;

var client = new HttpClient();
var appKey = "key=" + ApplicationConfig.FirebasKey;
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", appKey);

var response = await client.PostAsJsonAsync("https://fcm.googleapis.com/fcm/send", message);

return response;
var firebaseMessage=new firebaseMessage();
firebaseMessage.data=通知消息;

firebaseMessage.to=device.DeviceRegistrationId 从设备卸载应用程序时,FCM服务器会使相应的注册令牌失效,因此发送到该特定令牌的任何消息都会导致响应(另请参阅我的帖子)。在这种情况下,您可以继续删除令牌(或将其存档)


如果您的用例有意想知道消息是否在客户端收到,您必须执行。

感谢您的提示,查看响应正文后,我看到一个成功标志0,如果应用程序从客户端卸载,ios和android都经过测试