【问题标题】:Push Notification Channels Azure JS Backend推送通知通道 Azure JS 后端
【发布时间】:2016-01-24 15:55:32
【问题描述】:

我现在正在开发 Xamarin.Forms 应用程序,但在配置推送通知时遇到了一些问题。我已经关注了https://azure.microsoft.com/en-us/documentation/articles/partner-xamarin-mobile-services-xamarin-forms-get-started-push/ 上的文档,但这只会教您如何使用推送通知响应请求。

如何创建推送通知并将其发送给 Xamarin.Forms 中的用户?如何设置不同的推送渠道,以便一次通知特定的用户组?

事实上,这是我用于响应推送通知的 Javascript 后端代码:

  function insert(item, user, request) {
  // Execute the request and send notifications.
     request.execute({
     success: function() {                      
      // Create a template-based payload.
      var payload = '{ "message" : "New item added: ' + item.text + '" }';            

      // Write the default response and send a notification
      // to all platforms.            
      push.send(null, payload, {               
          success: function(pushResponse){
          console.log("Sent push:", pushResponse);
          // Send the default response.
          request.respond();
          },              
          error: function (pushResponse) {
              console.log("Error Sending push:", pushResponse);
               // Send the an error response.
              request.respond(500, { error: pushResponse });
              }           
       });                 
      }
   });   
  }

【问题讨论】:

  • 这只是一个建议。值得一看 parse.com,它有一个推送通知服务和适用于所有平台的非常简单的 API。

标签: javascript azure xamarin push-notification xamarin.forms


【解决方案1】:

推送通知很棘手,因为即使在表单上,​​它们也需要针对每个平台进行不同的处理。本文介绍了使用 .net 后端的整个过程,但它应该可以回答您的问题。

http://www.xamarinhelp.com/push-notifications/

您通过让他们注册到不同的标签,然后只发送到这些标签来发送给不同类型的用户。标签就是你所说的组。

【讨论】:

  • 是否可以向 RegistrationId 而不是用户发送推送通知?我知道 RegistrationIds 与用户相关联,但如果我可以使用 RegistrationId 对我来说会更方便。
  • 感谢您为我指明正确的方向,但我在这里找到了我需要的示例:stackoverflow.com/questions/20950514/…
猜你喜欢
  • 2016-03-12
  • 2016-12-11
  • 2015-05-12
  • 2016-04-24
  • 2015-05-06
  • 2016-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多