aws sns 行動裝置push服務(gcm 方式)

來源:互聯網
上載者:User

標籤:

aws雲端服務提供了非常完善的服務,行動裝置的訊息推送服務也非常不錯,且費用極低、效能良好。

雖然aws官網上有很詳細的步驟說明,但是偶還是走了一大圈彎路,主要由於對於Google的接觸實在太少,以至於在使用Google cloud message方式發送訊息的時候繞了個圈圈。

首先,aws官網文檔說明:http://docs.aws.amazon.com/zh_cn/sns/latest/dg/mobile-push-gcm.html

  • GCM 先決條件
  • 步驟 1:建立一個 Google API 項目並啟用 GCM 服務
  • 步驟 2:擷取伺服器 API 金鑰
  • 步驟 3:從 GCM 擷取註冊 ID
  • 步驟 4:使用 GCM 向移動終端節點發送推播通知訊息

其中,第一步和第二步,實際上是從Google官網擷取的,而不是從aws擷取的,就是這兩步比較繞彎。而且在國內必須翻牆才能查看資料。第三步和第四步根據aws官網的文檔即可完成。手機必須裝有Google的服務架構,且如果是國內手機,手機必須翻牆才能收到訊息步驟1:建立一個 Google API 項目並啟用 GCM 服務

進入Google網站,登入Google帳號(以下是官網文檔,翻譯在後面)

Creating a Google API project

To create a Google APIproject:

1.    Open the Google DevelopersConsole.

2.    If you haven‘t created an API project yet, click CreateProject.

3.    Supply a project name and click Create.

Oncethe project has been created, a page appears that displays your project ID andproject number. For example, Project Number: 670330094152.

4.    Copy down your project number. You will use it later on as the GCMsender ID.

 Enabling the GCMService

To enable theGCM service:

1.   In the sidebar on the left, select APIs &auth.

2.   In the displayed list of APIs, turn the GoogleCloud Messaging for Android toggle to ON.


翻譯:建立一個Google API項目

1        開啟Google開發人員控制台:https://cloud.google.com/console

2        如果尚未建立API項目,點擊CreateProject(建立項目)

3        輸入項目名稱並且點擊create(建立)

PS:盡量不要帶空格,project id自動產生即可

項目一旦被建立之後,會自動跳轉到項目詳情頁面,可以看到project id和project number,比如Project Number: 670330094152.


4        將project number複製下來,會在後面作為GCM sender ID用到。

 

啟用GCM服務

1 在左側的菜單頁,選擇APIs & auth

2 在展示出來的API列表,選擇Google Cloud Messaging for Android,並將開關設定為ON

 

步驟2:擷取伺服器 API 金鑰Obtaining an API Key

To obtain an APIkey:

1.   In the sidebar on the left, select APIs &auth > Credentials.

2.   Under Public API access, click Createnew key.

3.   In the Create a new key dialog,click Server key.

4.   In the resulting configuration dialog, supply yourserver‘s IP address. For testing purposes, you can use0.0.0.0/0.

5.   Click Create.

6.   In the refreshed page, copy the API key. You will needthe API key later on to perform authentication in your application server.

Note: If youneed to rotate the key, click Regenerate key. A new key will becreated. If you think the key has been compromised and you want to delete itimmediately, click Delete.


翻譯:
擷取API Key

1 在左側的菜單頁,選擇APIs &auth > Credentials

2 在Public API 標籤頁,選擇Create new key

3        在Create a new key對頁面,選擇Server key

4        在結果確認頁面,輸入你的服務的IP地址,如果是為了測試用,可以使用0.0.0.0/0.

5        點擊Create

6 在重新整理後的頁面,複製API key.後面的應用服務平台用到這個API Key

注意:如果你需要重新擷取API key,點擊 Regenerate key.會建立一個新的key。如果你認為這個key不安全並且想要立即刪除,點擊Delete.




aws sns 行動裝置push服務(gcm 方式)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.