2017-02-01 137 views
0

我有一個靜態的網站使用Azure存儲:網絡通知

https://helloweb.blob.core.windows.net/content/index.html 

什麼是我需要onesiganl應用程序設置來配置域:

網站URLhttps://helloweb.blob.core.windows.net

默認通知圖標網址:https://helloweb.blob.core.windows.net/content/icon.png

我的manifest.json:

{ 
    "name": "Hello Web", 
    "short_name": "Helloweb", 
    "start_url": "/content/index.html", 
    "display": "standalone", 
    "gcm_sender_id": "482941778795" 
} 

I can't see any user at onesignal users page. 
+0

你能解釋更多的什麼類型你是否期望通知事件觸發的地方等? – Aravind

+0

網絡推送通知。 https://helloweb.blob.core.windows.net/content/index.html是我想要收到通知的地方。 – Alvin

+0

您是否遵循了oneignal網頁推送設置中的步驟?也GCM是爲Android權利和網絡你有像「safari_web_id」。也是你分享的網址沒有打開(也許你把它只是爲了說明的目的,實際的網址是不同的) – Aravind

回答

1

根據onesignal document提到OneSignalSDKWorker.js & OneSignalSDKUpdaterWorker.js應該從頂級根送達。 在Azure存儲中,我們無法將設置爲頂級根中的blob。斑點需要一個容器。

上傳文件到頂級根目錄您的網站目錄。下面的網址應公開訪問:

https://yoursite.com/manifest.json

https://yoursite.com/OneSignalSDKWorker.js

https://yoursite.com/OneSignalSDKUpdaterWorker.js

OneSignalSDKWorker.js & OneSignalSDKUpdaterWorker.js

•這些文件不應該被重新命名,文件應該從頂層根

送達從我的經驗,它不是把網站在Azure存儲一個不錯的選擇。我們可以使用azure WebApp service輕鬆做到這一點。我做了一個測試。它工作正常。

以下是我的詳細步驟:

1,創建Web應用程序從Azure的門戶

enter image description here

2.Configure OnSignal設置

enter image description here

3.Download的Web Push SDK並按照tutorials編輯m anifest文件。

4。添加一個索引文件,只需要更換的「應用ID」

<head> 
     <link rel="manifest" href="/manifest.json"> 
     <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script> 
     <script> 
     var OneSignal = window.OneSignal || []; 
     OneSignal.push(["init", { 
      appId: "YOUR_APP_ID", 
      autoRegister: false, 
      notifyButton: { 
      enable: true /* Set to false to hide */ 
      } 
     }]); 
     </script> 
    </head> 

5.Upload使用捻(https://yoursite.scm.azurewebsite.net/).We可以直接拖動文件到文件夾中的代碼到Web應用程序。更多部署請參考官方document

enter image description here

enter image description here

  • 從Firefox瀏覽器訪問https://yoursite.azurewebsite.net/index.html。我們需要ŧ o設置設置消息彈出窗口的權限。
  • enter image description here

    從[所有用戶]
  • 檢查,我們將看到訂閱的用戶信息
  • enter image description here