How to make simple peer to peer chatting using android - java

I am developing chatting application using android. And my requirement is chatting. Now i am stuck that how i can achieve this for example through sockets, or through web services. I need to make my own server and then chatting between users. But i have no idea to do this. I also looking for complete example that how chatting will work but did not find any good example.

You may use webservices.Before that you have to know about GCM.Learn about GCM.Then continue your chat application with hopefully :)

Related

Android app need help connecting to a JAVA localhost server

I've had a look around and could not find what I'm looking for, so please feel free to redirect me.
I'm writing a card game that uses a Java server that stores the card information. I want to develop an Android app that connects to this server (via TCP/IP is my initial thought) and issues the commands i.e. pick up cards, play cards etc. (as the cards are stored in arraylists within the server app.)
My knowledge of Android is extremely limited and I cant find any good sources that could possibly help me, or explain how android networking works.
You need tcp server socket communication >
http://developer.android.com/reference/java/net/Socket.html
I would recommend to use a REST service and communicate via JSON. You can use for example Robospice in combination with Jackson2 which also brings you async communication and caching out of the box.
https://github.com/stephanenicolas/robospice/wiki/Starter-guide
Socket communication is really old school ;-)

Chat application - which tech is better to implement chat app in Android

*I have to make an android application which is basically a chat application.*In this chat app the user can interact with single user as well in a group that means Group chat is also there. I am using php as the back end for database . I have never done this type of work earlier so need some suggestions or guidance.
The options i have seen is as follow :
1. Web-services
2. Socket Programming
3. XMPP using the smack api
Now i am confused in them that which is better to implement chat feature in android. Also i didn't get any sample code for that. One of my team member is asking me to use the socket programming but i didn't get any sample app or anything for socket programming in android. I don't know socket programming this time. How we can connect the our phone to the server and then some other device. Hope you get me what i want to Conway you.
So can any one please guide me and show me the right direction to move on. Also if you can provide me any sample code, that can be really helpful. Any help is appreciated
Another option (besides XMPP, which is certainly a valid approach for chat, since it was designed for that) would be using WebSocket. Using WebSocket would open the possiblity of having a pure browser client as well.
For WebSocket on Android, there is AutobahnAndroid, part of the Autobahn family of WebSocket and WAMP implementations.
WAMP is a RPC and PubSub over WebSocket protocol with multiple implementations. There is also a PHP implementation of WebSocket/WAMP: Ratchet.
Disclaimer: I am author of Autobahn/WAMP and work for Tavendo.
For a basic Socket programming tutorial, you can check HERE and HERE.
However, I suggest using XMPP, as I have mentioned HERE, as it is a protocol designed from the ground up to be used for Messaging.

How to proceed for making chat application using jsp's and servlets

I developed a chat application using java.But now my challenge is build a chat app in web application.I dont how to proceed.Can we use sockets as done in java.
Please give me a suggestion to get through this.
Thanks in Advance.
I recommend you to use websockets as they're really efficient to exchange in real time (push instead of pull) data between a server and html clients. They're bidirectionnal and roughly equivalent to the sockets you're used to (hence their name). Client-side, they use the same callback based logic than ajax clients but that doesn't mean they're not fast.
Here's a tutorial : http://java.dzone.com/articles/creating-websocket-chat
Googling "java chat websocket" would give you other results.

How to implement a real time bidirectional connection with server in android

I have experience developing in android and using REST services, but now I'd like to implement an online game for android. For example a tic-tac-toe for multiplayer, where a user can invite to other to play a game and each one receive the actions of the other in real time.
Using REST for this kind of apps would require constants surveys to the server for updates and its a bad idea.Isn't it?
My question is what are the typical aproaches for this kind of "permanent" connections. I just need some hints about the technologies and protocols in client and server for start searching and read :D
Thanks
You can use sockets directly but for a game like tic-tac-toe, it shouldn't be THAT chatty, using REST would be ok.

Chatting application Android

I'm on developing an android application which allows users to chat I created an interface and its code for chatting ..
but I don't know how can I make this interface shared for each contact and how can I show his conversations ??
thanks in advance ...
You probably will need to elaborate some more to get a better answer. Try to be as specific as possible. i.e. what technology do you intend to use to make the connection between two chatters?
There is a nice example in the SDK that implements a bluetooth chat client
http://developer.android.com/resources/samples/BluetoothChat/index.html
I'd definitely dig in to that some if I were you. Even if you aren't wanting the connection to be made via bluetooth it should give you some insight on how to hook up the incomming and outgoing chat messages to the Views on the screen

Categories