简体   繁体   English

Google云消息传递 - 有没有办法查看所有已发送(或排队)通知的列表?

[英]Google Cloud Messaging - is there a way to see list of all sent (or queued) notifications?

We have a strange issue: We use PushSharp to send out notifications to Android devices, and the logs say Notification sent , but none are received on the device. 我们遇到一个奇怪的问题:我们使用PushSharp向Android设备发送通知,日志显示已Notification sent ,但设备上没有收到Notification sent If I change the Registration ID (replacing a character with something else), I do get "Invalid token" error, so I believe my requests make it to the server. 如果我更改注册ID(用其他东西替换一个字符),我会收到“无效令牌”错误,所以我相信我的请求会进入服务器。

I'm wondering if there is a way to see a log of all sent (and/or queued) notifications somewhere on Google server , or if it's possible to enable such logging. 我想知道是否有办法在Google服务器上的某处查看所有已发送(和/或排队)通知的日志,或者是否可以启用此类日志记录。

Basically - How can I troubleshoot notification delivery? 基本上 - 我如何解决通知传递问题?

The GCM server returns a response for each message you send to it. GCM服务器为您发送给它的每条消息返回响应。 That message tells you whether the message was accepted or rejected by the server (it doesn't tell whether it was actually delivered to the device), and also specifies the type of error if any. 该消息告诉您该消息是被服务器接受还是拒绝(它不会告诉它是否实际传送到设备),并且还指定了错误类型(如果有的话)。

PushSharp probably reads this response and notifies about errors (such as the "Invalid token" error you got when you used an invalid registration ID). PushSharp可能会读取此响应并通知有关错误(例如,使用无效注册ID时出现的“无效令牌”错误)。

If you don't see any errors, the problem is probably in your client application (either in the manifest or in the code that receives the GCM messages). 如果您没有看到任何错误,则问题可能出在您的客户端应用程序中(无论是在清单中还是在接收GCM消息的代码中)。

well, actually it turns out to be tricky. 好吧,实际上事实证明是棘手的。 As per PushSharp documentation I was using the following code to send notifications: 根据PushSharp文档,我使用以下代码发送通知:

push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
                      .WithJson(@"{""alert"":""Hello World!"",""badge"":7,""sound"":""sound.caf""}"));

and that was a mistake :) Google needs me to use "message" and "title" fields for notification body message and title respectively. 这是一个错误:)谷歌需要我分别使用“消息”和“标题”字段的通知正文消息和标题。 As soon as I changed code to the following, it started to work: 一旦我将代码更改为以下内容,它就开始工作:

push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
                      .WithJson(@"{""message"":""Hello World!"",""title"":""your app name""}"));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以使用.NET桌面应用程序作为Google Cloud Messaging通知的接收者吗? - Is it possible to use a .NET desktop application as the receiver for Google Cloud Messaging notifications? 有没有一种方法可以将推送通知从Web门户发送到Google Cloud Messaging? - Is there a way to send push notification from a web portal to Google Cloud Messaging? 有一种方法可以发送所有完整的选项,出现在Firebase云消息传递中创建消息传递页面 - There is way to send all full options appear in firebase cloud messaging create messaging page 如何从Firebase云消息传递接收推送通知 - How to receive push notifications from Firebase cloud messaging 异步(排队)消息传递和关联的会话数据 - Async (Queued) Messaging and associated Session Data 使用Azure Notification Hub的Google Cloud Messaging有效负载和应用程序数据 - Google Cloud Messaging payload with application data using Azure Notification Hub 如何在Xamarin Android中使用Google Cloud Messaging(GCM) - How to use Google Cloud Messaging (GCM) in Xamarin Android C#中的Google Cloud Messaging Server端代码 - Google Cloud Messaging Server Side Code in C# Xamarin Google Cloud Messaging GcmClient.CheckDevice(this)导致运行时错误 - Xamarin Google Cloud Messaging GcmClient.CheckDevice(this) causes runtime error 如何在 Xamarin.iOS 中使用 FCM(Firebase 云消息传递)发送 iOS 推送通知 - How to send iOS push notifications using FCM(Firebase cloud messaging) in Xamarin.iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM