Question

This is what I want to achieve:

I have an android phone app (native) and a desktop PC application (Delphi) that "know" each other (that means somehow they have been initialialized to know each others globally unique ids). If I do a specific action on the phone, I want to transmit data (some bytes to several kB) from the phone to the PC via the Internet. (Using an external server / service for this is OK.)

Constraints:

  1. phone or PC could be anywhere in the internet, eg behind a NAT-Router and/or behind a firewall
  2. there should be no configuration necessary by the customer (despite the setup of the unique ids). It should work out of the box.
  3. start of data transfer should be fast (preferably < 1 sec)
  4. potentially there will be several thousand users that will use the service
  5. I would prefer to not rely on a google account (this is not a deal breaker)

First idea was to setup a REST service, to which the phone would send data and which the desktop application would be polling. But that does not seem to be elegant and I have some concerns about how this scales. Any other ideas?

Edit: The final program should be something like a remote control for the Windows application. So something like Google Cloud Messaging for Windows would help (but from MS this seems only to be available for Metro apps).

No correct solution

OTHER TIPS

It seems to me you are on the right track. Use retrofit or the native libraries to POST, and since you have a nice, stable connection to the internet in the PC( that's plugged into a friggen' wall =] )why not make occasional pings to the server with the PC and register that IP for notifications? Sure, their IP will sometimes change when they drop off the 'net, but hardly enough to be a problem.

That being said If you want to do this super, duper easy, use Parse, my friend =] It scales nice and easy, sure for some money once you hit a certain usage, but I think you'll be glad to pay it when you get to that point. It's way cheaper than a server op, anyway! Does it do pushes? oh yes. Does it make easy Android/iOs apps? Well, is NoSQL easy? =] You can even write some js to run on the cloud, if you really want to.

shanti

As you wrote it: constantly polling the server for new data is not elegant. Even if there are thousands of sending Android applications, so the poll request might continuously return with data.

You can choose a different protocol, which supports asynchronous send from the server to the Delphi application. MQTT and STOMP are two of them. They provide text and binary message payloads, and your Delphi application would receive messages when the server pushes them.

If you expect such a high number of Android sender devices I would also recommend to evaluate message brokers such as ActiveMQ or RabbitMQ. They make asynchronous operation so much easier - your Delphi application can be stopped for a while (for maintenance) without missing any messages. These message broker also offer useful features including high availability and persistent storage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top