The*_*eaf 4 azure push-notification azure-notificationhub
我们正在学习本教程:如何:适用于Android的Windows Azure通知中心(Android应用程序).
在构建通知有效负载时,一切正常,如指南中所述.那是:
{
    "data": {
        "msg": "$(property1)"
    }
}
但是,我们希望扩展模板以在有效负载中使用多个自定义属性.就像是:
{
  "data": {
    "msg": {
        "message": "$(property1)",
        "sender": "$(property2)"
    }
  }
}
后端通过以下方式提供属性值:
Dictionary<string, string> templateValues = new Dictionary<string, string>
    {
        { "property1", "Hello world" },
        { "property2", "foo" }
    };
NotificationOutcome notificationOutcome = await Hub.SendTemplateNotificationAsync(templateValues, "test");
从移动应用程序在通知中心注册模板时,我们收到以下错误:
"提供的通知有效负载无效"
提前致谢
小智 6
有效内容无效,因为GCM不支持数据成员中的嵌套对象.您可以通过注册以下模板来发送带有两个属性的消息:
{
   "data": {
      "message": "$(property1)",
      "sender": "$(property2)"
   }
}
在你的Android接收器中,你可以检索你的属性
intent.getStringExtra("property1");
| 归档时间: | 
 | 
| 查看次数: | 4003 次 | 
| 最近记录: |