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

*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.

Related

TeamSpeak 3 MusicBot in Java

I want to make a TeamSpeak 3 Musicbot in Java. But I don't find any Protocol from Teamspeak for the Voice transmission. And after searching for a Client API, for Java, I didn't find anything. Only for a ServerQuery but that doesn't help me I think.
I only want the Client to connect to the Server and then plays a Song, though that wouldn't be that hard!
Maybe you Guys can help me?
Teamspeak does not have an official client-api. You can only use the Query-API and create plugins. As the Query-API does not support any voice-communication, that's not the way you should go. The (most) official way of creating a Teamspeak3 MusicBot would be to run a client on your server which has a plugin installed which allows you to play music (more or less a soundboard). Sinusbot is exactly built this way.
Another "unofficial" option would be to make use of unofficial reverses of the teamspeak-protocol and built you own client from these. If you want more information about this, this repository might help you (and look for other projects the creator pushed, they might help you too).
I'm not quite sure if this helps, but have been developing a TeamSpeak 3 music bot using Kotlin, which is compatible with Java as it runs on the JVM (Java Virtual Machine)
The way it works is that it first launches the TeamSpeak client and connects to the desired server and channel, then it starts monitoring the chat log -> the bot can be controlled by entering commands into the chat.
The bot uses the TeamSpeak ClientQuery via Netcat to send messages to the chat.
It is completely client-side so you don't need to be server admin to get it working.
The bot currently supports Spotify, YouTube, and SoundCloud.
You can check it out at https://gitlab.com/Bettehem/ts3-musicbot

How to make simple peer to peer chatting using android

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 :)

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 ;-)

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.

Categories