0

I'm using C2DM in a project. I want to show device status (battery remaining, sdcard availability...) when user logs in my website. Here is my implementation:

  • Upon their log in, the 3rd-application server (my website) will send a "login" push notification message to the device
  • When the device receives the "login" notification, it will send the latest device status to the 3rd-application server

If when the device is offline, the 3rd-application server will not receive any update. I currently define a "timeout" (1 minute) to detect if the device is offline or is not able to send device status.

My questions are:

  • Is there a better way to implement this app?
  • How to choose a best "timeout" value?
Bao Le
  • 16,643
  • 9
  • 65
  • 68

1 Answers1

0

"The best timeout value" is the one that suites your application or your needs the best. If you think trying every other minute might catch the device in an online state, then that's the way to go.

I personally would refresh at a larger interval (10 minutes for example, or 30), or on pressing a "Try again" button.

I think "a better way" would be to store every time the last received data from every device. So, if I log in and my device is offline, my last retrieval of the status will be displayed, alongside with its date(e.g. Battery: 59%, Yesterday at 3:44 PM).

Raul Rene
  • 10,014
  • 9
  • 53
  • 75