views:

429

answers:

3

Guys

What is the general communication architecture for two android applications?

Case 1:

I have two android applications,

a) One is a server that waits for client request, process the request( read data from some sqlite db) and return the results to the client. This server application runs on its own independent android phone.

b) The second is the client that sends the request to the server application in (a) and it too runs on its own independent android phone.

Question is, do the two applications have to go through the Mobile Service Provider to enable communication? or they can just talk to each other directly via some public IP/WIFi etc. What is the communication structure/architecture for this applications?

Case 2:

I have an android application running on an independent android phone, and i want it to talk to some server application (Web Server / Application Server) running in some machine somewhere on the internet, sends request and get some feed back.

Again, do the two applications have to go through the Mobile Service Provider to facilitate communication? or they just establish a straight TCP/IP communication via some public IP?

Any reference articles would really help.

Thanks

Gath

A: 

I'd suggest Android – IPC, aidl and IBinder and Grasping Android's IPC mechanism for a start. After that just hunt on Google for 'Android IPC'

boost
Actually, the OP is asking about between different phones; Android IPC only works between different apps on one phone.
CommonsWare
Oh dear, how embarrassing. Sorry (blush).
boost
+1  A: 

Question is, do the two applications have to go through the Mobile Service Provider to enable communication?

If you want to use 3G, yes. If you want to use WiFi, no. Generally, Android applications do not care where the Internet connection comes from.

or they can just talk to each other directly via some public IP/WIFi etc.

If they have a WiFi connection, they have a WiFi connection. What you do with that WiFi connection is up to you, using Java sockets, and respecting all the normal problems with Internet access (e.g., NATs).

Again, do the two applications have to go through the Mobile Service Provider to facilitate communication? or they just establish a straight TCP/IP communication via some public IP?

You ask for a Java socket. You get a Java socket. You do something with the Java socket. Where that Java socket comes from and how its connection works is generally under the covers: 3G, WiFi, a squadron of very tiny passenger pigeons, etc.

CommonsWare
A: 

Something about sync is here Synchronization in Android

Shtirlic