我正在查看有关使用AppCenter发送推送通知的documentation。我能够成功创建和发送推送通知,但是我不明白为什么我们需要name
对象中的notification_content
属性。需要吗?谁使用它?
我问的原因是我想根据其类型在客户端设备上过滤掉通知。我希望为此目的使用name
属性,而不是在custom_data
中创建另一个属性。
在Android上,我可以像这样检索通知标题和文本:
var title = statusBarNotification.Notification.Extras.GetString("android.title");
var text = statusBarNotification.Notification.Extras.GetString("android.text");
还有一种方法也可以检索name
属性吗?
First无法从Notification接收name
属性。
从Send Notification document开始,name
属性用于如下定义通知消息的名称。
{
"notification_content": {
"name": "First Push From App Center",
"title": "Push From App Center",
"body": "Hello! Isn't this an amazing notification message?",
"custom_data": {"key1": "val1", "key2": "val2"}
}
}
name
:定义通知消息的名称。Second此属性仅用于App Center,您不能从通知数据如下图。
如果您在App Center中不使用API来查看有关发送通知的this document,您会看到广告系列名称是API中的name
属性。
用广告的描述性名称填充广告系列名称字段。您提供的值将显示在App Center广告系列列表页面中。
它仅显示在App Center列表页面中,但是我也找不到其他API在App Center中获取此属性。
Finally,如果我们无法从Notification Data甚至App Center中检索到它,那么我建议您使用custom_data来定制所需的数据。