Messaging between Android application and Chrome extension

863 views Asked by At

I'm hoping to use Google Cloud Messaging to send messages between an Android application and a Google Chrome extension. The basic process would be:

Android app starts up...
... Android app sends initial message to Chrome extension (on PC)
... Chrome extension sends initial response message back to Android app.
... [Android app and Chrome extension continue to exchange messages]

The Android app will be using Google authentication, and the Chrome extension will of course require the user to be logged in.

Is this possible without an intermediate server? I've done some initial research, but much of the documentation seems to concentrate on using GCM between Chrome <> Server, or Android <> Server rather than between Chrome <> Android.

Thanks.

1

There are 1 answers

3
Eran On

I have no experience with Chrome extensions, but as for sending GCM messages from the Android application instead of from a server, it should be possible.

Whatever code the server would normally use to contact Google servers to send GCM messages (for example the HTTP request required for sending GCM messages to Android devices) can be executed from the Android app (and probably from the Chrome extension as well, though I'm not sure about that).

The main downside to not using a server is that you don't have a central database of all the devices registered to GCM. Your Chrome extension would have to somehow know the Registration IDs of the Android devices it should send messages to and vice versa.