views:

341

answers:

3

I want to transfer data between a smart phone app and a website. What are the conventional and not-so-conventional ways of doing it?

Here's what I have thought of so far:

  1. Simple HTTP GET/POST with data being represented as JSON array string, variations of this being encrypted/compressed string as parameter.
  2. Webservice calls ( I am not sure if this is even possible, just a guess)
  3. Two step communication : Smartphone to/fro Desktop App to/fro Website) (Cumbersome to develop/use)

Also, what do I need to consider to avoid spamming/snooping?

+1  A: 

I think the first two are pretty much the same thing. What you want to do is an HTTP Post if you are sending a lot of data, or a GET with a query string if theres a smaller amount of data. It's all going to be unencrypted transmission, so keep that in mind when using HTTP.

Karl
+1  A: 

If your goals is convince, security and ease of development. I'd have the client (phone) make requests to the server over HTTPS using POST. The data sent should be what ever library is available for your target system. Good choices are URL Encoded parameters, XML and JSON. Avoid Binary protocols.

The downside of this approach is using network connectivity from a device to the web service may not be available or expensive, with the plan the user has. (this is becoming less so with the current wave of smart phones (iPhone/gPhone/Blackberry etc)) This is also a polling interface, so pushing data from the server to the handset is tricky and dependent on the User initiating some action.

Depending on the phone platform, you could also use SMS, for bi-directional communication. The limitation here is privacy, bandwidth and cost. SMS's are more expensive to send the ip data depending on user plan. (and sometimes to receive) The bi-directional trick is performed by registering a SMS hook in the phone application. Thus the application can be automatically started and notified when a certain SMS is received.

Please post additional information, like target platforms and I can discuss further options.

Scott Markwell
The target platform is Blackberry. I was looking for a good way from the architecture point of view.
Rohit
Decoupling protocol architecture from target platform in the mobile space is currently very hard. The only method that is highly likely to work is an HTTP request, because it's supported on most platforms, and will clear carrier proxies.
Scott Markwell
+1  A: 

If you're using the .NET Compact Framework and developing for Windows Mobile, the easiest approach is to use web services. However, .NET web services serialize everything as verbose XML, which makes the size of the data sent back and forth larger than it has to be. Using JSON is a good way of cutting down on the size of your data, even when using .NET web services (the trick is to send an entire JSON document as a single parameter). Minimizing the size of your transferred data is especially important for Smartphone applications, since your data transfer will probably be done over a cellular network.

MusiGenesis