Reputation: 311
I am building a distributed android application where communication is done both between a client and a server and between clients themselves. Communication between the client and server is done by using Spring framework on the client and nodejs with restify on the server.
But I am having some problems finding good ways to communicate between two android applications. I would like to have some sort of server on the client side, is Spring viable for this or should I just create a thread and use androids http library?
This is probably a vague question but I would like some feedback on how to implement this since it is difficult to find similar projects.
Edit: Thought about how applications like facebook messenger and other apps that needs Wi-Fi gets instant messages, how is that done? The apps need to run some kind of listener and the server needs to contact the clients, this is what I want to do except replace the server with another client.
Upvotes: 0
Views: 355
Reputation: 761
Running a server on an Android device is almost always a bad idea because it drains the battery and your ip address might change often. If you need device-to-device (android-to-android) communication, have a look at push notifications (you will need to route your messages through the server) https://developer.android.com/google/gcm/index.html
Upvotes: 2
Reputation: 837
You should try RoboSpice. It's cool library that keeps network operations completely asynchronous. It supports many of the popular Android networking libraries like Spring and Retrofit.
Upvotes: 0