Contenu connexe
Similaire à 透過 GCM 實作跨裝置資料同步 (20)
透過 GCM 實作跨裝置資料同步
- 2. • 關於 Rogery
&
KKBOX
Android
Team
• Concept
&
Idea
• Implement
• Demo
• Q
&
A
Agenda
- 3. • 從 Android
1.0
開始研發 KKBOX
Android,
開發經驗至今已四年以上
• 在 KKBOX
擔任 Android
Team
Leader
• 熱愛音樂創作的工程師 http://youtu.be/IwsNKobAkS0
關於 Rogery
- 4. • 產品:KKBOX
Android,
KKBOX
Music
Store,
UtaPass
• 裝置:Handset,
Tablet,
STB 和車機
• 團隊人數從 1 人到 11 人
關於 KKBOX Android Team
- 6. GCM (Google Cloud Message)
• 幫助開發者發送推播訊息到各個 Android 裝置
• 首次在 Google
IO
2012 亮相
• 前身是 C2DM
(Cloud
to
Device
Messaging)
- 13. Polling vs Pushing
• Polling: 每個裝置定期去向 Server 問目前最新的狀態
• 目前 KKBOX 實作歌單同步的方式
• 容易實作
• 耗電:手機一直送連線、Server 一直收連線
- 18. Push & Sync
(2)
(3)
(1)
1. push change to server -‐
ref.1
ref.2
2. send
sync
message
to
GCM
-‐
ref.3
3. client
receive
sync
message
from
GCM
-‐
ref.4
4. pull
change
from
server
-‐
ref.5
5. return
change
to
client
-‐
ref.6
(4)
(5)
- 21. Demo Source
• KKGCMSyncServer – GitHub
- https://github.com/rogery/KKGCMSyncServer
• KKGCMSyncClient – GtiHub
- https://github.com/rogery/KKGCMSyncClient
- 22. References
• C2DM
- https://developers.google.com/android/c2dm/
• GeYng
Started
with
GCM
–
Android
Developer
-‐
http://developer.android.com/google/gcm/gs.html
• Google
Cloud
Messaging
for
Android
–
Google
I/O
2012
-‐
https://developers.google.com/events/io/2012/sessions/gooio2012/100/
• StopWatch
Demo
–
Google
I/O
2013
-‐
http://bradabrams.com/2013/06/google-io-2013-demo-android-studio-
cloud-endpoints-synchronized-stopwatch-demo/