簡體   English   中英

注冊帶有標簽的推送通知在 azure 通知中心不起作用

[英]Registering Push Notifications with Tags not working in azure notification hub

我知道這個問題主要是標簽注冊 ANH的重復,但沒有具體答案,這就是我再次提出的原因。

我正在開發 Cordova 應用程序並使用此 Azure 移動服務插件 ( https://github.com/Azure/azure-mobile-apps-cordova-client ) 注冊推送通知。 我得到了來自 PNS(gcm 和 apns)的成功響應,並且向通知中心注冊(注冊事件)的調用也在下面返回了成功響應。 當我使用 Azure 通知中心的“測試發送”實用程序發送通知而不指定標簽時,我也會在設備(在 IOS 和 Android 上)收到通知,但是當我嘗試使用標簽發送通知時沒有收到通知。 還有其他方法可以注冊標簽嗎?

client.push.register('gcm', handle, {
      mytemplate: { body: { data: { message: "{$(messageParam)}" } },
                 tags: [tag}                          
  }).then(function(data){
        alert("success");
    },function(error){
        alert(error);
    });} else if (device.platform === 'iOS') {
  // Register for notifications.            
  client.push.register('apns', handle, {
      mytemplate: { body: { aps: { alert: "{$(messageParam)}" } },
                  tags: [tag]}                           
  }).then(function(data){
        alert("success");
    },function(error){
        alert(error);
    });} 

如果您正在使用指定的插件,那么您確實有后端代碼。 標簽只能在后端注冊 - 而不是前端(好吧,除非您在請求中發送標簽,然后在后端讀取該請求以執行相同的請求 - 但這仍然是后端進行注冊)。

這一點。 我建議不要將 Azure 移動應用程序用於此功能。 創建一個為你注冊的 Azure 函數 API,然后使用它來注冊推送。 Azure 移動應用程序的未來版本將不包含 ANH 功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM