0

I want to build an Android app that streams data from wireless sensors (about 3 kb/s) to my server.

To wake up the phone it turned out I cannot easily use a socket from my server, but need a GCM push notification. However, if Im implementing all the GCM stuff just to start streaming, it could be easier to use GCM for the datastream too, instead of my own websocket implementation.

The docs say a packet can be max 4 kb, and that should be enough if the device can reliable transmit them once per second. But since GCM wasnt designed for such fast interval and bandwiths, does anyone have experience if it would be feasible and reliable, or would it be better to open a direct connection to my server instead?

Maestro
  • 9,046
  • 15
  • 83
  • 116
  • It wouldn't be feasible. There is no guarantee as to when a message will be delivered. In practice the delay can vary from nearly instantaneous to tens of minutes. – NickT Feb 19 '14 at 11:05

1 Answers1

0

I would go with a direct connection to your own server, mainly because as you say, the GCM service wasn't really designed for this and Google hold the right to throttle the connection and delay the GCM notifications if they think you are using too much bandwidth. I've experienced this myself when conducting stress tests - the notifications start slowing down and eventually the gmail accounts that the devices where using were banned.

The general pattern for GCM should be something similar to:

  1. Something happens on the server that the devices need to know about.

  2. A GCM notification is sent to the device with a small payload, say CommandNumber = 1 for example.

  3. The device listens to the notification, and because the CommandNumber == 1 it responds in a certain way, which could be opening a socket to your server in this case.

CurlyPaul
  • 1,138
  • 1
  • 10
  • 29
  • The problem with this option is, if our company has to shutdown its servers in the future, the app will stop functioning too. I'm looking for a way to send messages to other instances of the app, and if it was purely based on GCM, there is no need for us to keep up a server just for tunneling that traffic. – Maestro Mar 17 '14 at 14:58