Firebase Cloud Messaging

From Wildsong
Revision as of 00:17, 29 May 2013 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

AKA GCM

From what I can tell the GCM CCS "Cloud Connection Service" does not work because it requires Google to enable it, and they don't respond when you fill out the request page. http://developer.android.com/google/gcm/ccs.html

http://developer.android.com/google/gcm/index.html

Getting started doc: http://developer.android.com/google/gcm/gs.html Talks about obtaining API key

The joy of multiple consoles:

Google APIs Console Page: https://code.google.com/apis/console where you can find keys under API Access and learn more about OAuth 2.0

Google Cloud Console: https://cloud.google.com/console#c=l

Overview

My understanding is this

  • Mobile client sends message to GCM via XMPP
  • GCM forwards message to 3rd party server (that's me).
  • 3rd party server can send messages to clients via GCM server.

Advantages

  • Google server can do store and forward so neither mobile nor my server need be online 100% of the time.
  • Saves battery by using only one connection for all services with phone.

It is unclear to me the relationship between "GCM" and "GCM Cloud Connection Server" http://developer.android.com/google/gcm/ccs.html CCS is XMPP based. I am coming to the game late, seems like the old way was just HTTP based? Enlighten me please.

It looks like I should be able to use an XMPP client to talk to CCS from my server. Then Google handles the interaction with my phone.

Python - There is a sample on the Google page. http://developer.android.com/google/gcm/ccs.html

It also looks like there are many hoops to jump through and at the moment I don't need this. XMPP for me.

Sample gcm server

Web App that runs in Tomcat

Sends a message to any registered Android devices that says "You got a message".

WebContent/

index.jsp just loads home via webmapping /home

WEB-INF/

lib/

  • gcm-server.jar -- sources are at the root level in the gcm code
  • json_simple-1.1.jar -- probably a json parser

Servlets

  • RegisterServlet -- accepts connections
  • UnregisterServlet --
  • SendAllMessagesServlet -- sends a message to all registered devices
  • HomeServlet - displays existing messages and allows sending a new one