Create Chat Application In Android Studio
In this article, We will Tech how to create a chat application in Android Studio. In order to follow our guidelines on how to make an android chat app, you will need to install Android Studio. We’re going to build a realtime group and one to one chat app for Android using the Openfire XMMP Server. It will work like WhatsApp and Facebook Messager. So, You can also make a video and audio call through this application. In additionally, You can also ban misbehavior users account and IP address. Therefore, You have full control of your android chat application using a web admin panel.
Android Chat App Features
It’s most important to discuss android application features which we want to create in the android studio. It has more features but we will describe some most popular features.
- Group Create and Join
- Audio And Video Call
- Send File and Image
- User Status
- User Presence
- Block User
Setup Android Studio Project
First of all, We need a project for android application. There are a lot of free Projects are available on Github with GNU General Public License v3.0.Therefore, We can do Modification and also free for commercial use. So, We will use the android studio project one of them. Most Popular android studio project links are given below.
Conversations ( Group and One To One Chat )
Xabber-Android ( Group and One To One Chat like Whatsapp )
A Talk-Android ( Audio and Video Call )
So, We will clone the first project and also we will change the package name in the android studio. Simply open the project link in a new tab and copy Clone or download link and paste into an android studio like this.
Once our project downloaded then we will change the android chat app package name. In addition, You also need to change your database server domain name from Config.Java file. So, the guideline is shown in the following screenshot.
Once our Android Project completed, Now we need Openfire XMPP Server to run the Android chat app. If you don’t know-how to install the XMPP server on Ubuntu VPS Server. So, Simply visit another article How To Install Openfire On Ubuntu.
Setup Openfire XMPP Server For Android Chat Application
Once our Openfire XMPP Server installed on Ubuntu. Now, We need an important setting in Openfire. So, We will install Openfire Plugins from the Admin Panel to our Android Chat App. You need to install the following Plugins from Plugins Option in Openfire Admin Panel. A lot of plugins are available but we will install the most useful for an android chat application.
- Registration ( User Registration Service Plugin )
- HTTP File Upload ( Images and File Sending )
- Jingle Nodes Plugin ( For Video and Audio Call )
- Monitoring Service
- MUC Service ( For Group Chat )
- Avatar Resizer ( Profile Pic )
- Bookmarks ( A Group chat Bookmarks For Every New User & user bookmarks)
- Presence Service
- STUN server plugin ( Video Calling )
- User Status Plugin ( Trace User IP In-Database )
- Content Filter ( Bad Words Filter )
Setting For Video Call Application
If you want to make a video call application in android studio. So, We need to install Jingle Nodes Plugin. In addition, We also need to setup Jingle Nodes Ports. Therefore, the Ports setting shown in the following screenshot.
Once you are jingle nodes setting completed. Now, You’re video call work properly. If any problem will occur then you need to install Turn Server on Ubuntu VPS. In addition, the process is given below to install the Turn Server on Ubuntu.
Install Turn Server For Android Video Chat Application
Now, Open your ubuntu terminal window using putty with root and run the following command.
sudo apt-get update
sudo apt-get install coturn
Run the following command to enable Turn Server.
sudo sed -i '/TURNSERVER_ENABLED/c\TURNSERVER_ENABLED=1' /etc/default/coturn
Once the turn server installed and enabled. Now, we need some settings for video calling. So simple, run the following command to open the configuration setting file.
sudo nano /etc/turnserver.conf
Set up your Turn Server setting like this.
listening-port=3478 tls-listening-port=5349 listening-ip=185.XX.XXX.XXX (put here your ip) relay-ip=185.XX.XXX.XXX (put here your ip) fingerprint lt-cred-mech realm= your domain name total-quota=100 stale-nonce cert=/ssl/nws.crt #( your ssl certification path ) # pkey=/ssl/nws.pem also set cipher-list="ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5" no-loopback-peers no-multicast-peers
service coturn restart