sparta123
sparta123

Reputation: 31

how to connect 2 android phone through server

I am trying to make an app which will allow users to register and send pictures to each other. I am just wondering how to make it possible for 2 android phones to connect with each other using an internet connection? Only thing I know is of Server-Client communication but I am not sure whether this will work. When I searched I also read about GCM but if I understood correctly this is only for getting the server to send a message to an android device but not for the device to send back to the server.

Thanks for your help

Upvotes: 2

Views: 426

Answers (3)

Suhail Mehta
Suhail Mehta

Reputation: 5542

you can use study about sockets and can use XMPP for this thing. Message and attachment sharing can be done just by having the ID. You can find many open source libs for this thing.

GCM is not real time message sending but with XMPP you can get just real time message transfer between clients.

You can use openfire with aSmack lib to implement this functionality.

Link for ref: http://www.igniterealtime.org/projects/openfire/

Upvotes: 1

Dimitris Fousteris
Dimitris Fousteris

Reputation: 1111

You can use GCM to notify the clients that a change of data has been made. The clients can send data using a web service exposed by a server. For example when a client wants to send data to another it calls the webservice by sending a http request with the appropriate parameters, and then the server stores the data to a database and updates the rest of the clients for the change(in this case using GCM)

Upvotes: 1

Akshay Soam
Akshay Soam

Reputation: 1620

You can use GCM... In GCM you register your android device and send the message with the registration id (provided by Google) to the gcm server and yes it is a very good option.

Google IO 2010 describes it very well.

https://www.youtube.com/watch?v=PLM4LajwDVc

Upvotes: 0

Related Questions