作者dwadefans (wade)
看板AndroidDev
標題[問題] gcm REGISTERED DEVICE ID要在哪看呢?
時間Sun Aug 2 19:28:01 2015
因為新版的GCM改過許多
以前舊版的程式跟現在差了許多
而且Google平台上的操作方式也不同
https://developers.google.com/cloud-messaging/android/client
我照著上面的方式做完了 也有成功push notification在手機端
不過我想要使用GCM HTTP connection
https://developers.google.com/cloud-messaging/
send的網頁是
https://gcm-http.googleapis.com/gcm/send
還有設定key 但是只有device id 我不知道該去哪看
https://developers.google.com/cloud-messaging/http
上面這網頁的「Checking the validity of an API key」部分
使用curl 來 send message
=======================================================
# api_key=YOUR_API_KEY
# curl --header "Authorization: key=$api_key" \
--header Content-Type:"application/json" \
https://gcm-http.googleapis.com/gcm/send \
-d "{\"registration_ids\":[\"ABC\"]}"
=======================================================
這段要給apikey與registration_ids(置換掉ABC)
不過不知道怎麼操作...
另外在github上找到一個用php push message的程式
https://github.com/mattg888/GCM-PHP-Server-Push-Message
一直對於那所謂的device registion id (registration_ids) 不了解
求神人解答感謝 :D
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 115.43.23.4
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1438514886.A.6D7.html
→ dwadefans: 找到了 在官方程式RegistrationIntentService裡面的 08/02 19:46
→ dwadefans: 57行 有用Log印出GCM Registration Token: 08/02 19:46
推 ckvir: 用 parse 比較簡單 08/02 20:50
→ dwadefans: 可是我沒有要使用到parse服務呢 08/02 21:22