No one here is going to do the work for you, this is what you are indicating in the comments. As NotPoliticallyCorrect said, a simple google search will solve your problem.
https://www.google.com/search?q=android+peer+to+peer+chat&ie=utf-8&oe=utf-8[
^]
Also, you say you want it to work over the internet and not wifi. But these are android devices...am I missing something?
Quote:
1. There is any solution for that issue without connection server in the middle, sending messages/data between different devices (without any third part component).
If you aren't willing to entertain 3rd party components, be prepared to roll up your sleeves and do some work. Because if you don't want to pay for something then you are probably going to have to build it yourself.
Quote:
2.If the answer for question 1 is NO! (or it's very difficult for implementation) . May you can suggest a way to implement with server in the middle (how to keep the channel open ?) .
The server need to keep the sockets of the two devices open all the time?? , or may to connect made by demand (how application like whatsapp work?).
Based on this second question, you really need to do some research on how web services work. What you are probably going to end up doing is exposing a web service that can respond to the requests of your devices as necessary. Now the web service is something you are going to have to build.
I suggest you google, how to build a web service in java, to complete this portion.
Then your devices will make calls to the web services based on what your requirements are/what you are trying to accomplish.
You need to remember, we are not a service that does the work for you. If you want someone to hand over their work you need to go to freelancers.com or something like that.
Now, should you attempt this project and get stuck along the way, feel free to come back with a clear explanation of your issue, some relevant code samples and a better attitude towards getting help and I am sure someone will be happy to provide you assistance. You need to keep in mind that we don't have access to your computer, your code, nor do we read minds or know anything about your project.