How to Make Chat Application In Android Studio
In this article, We will teach 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 real-time group and one-to-one chat app for Android using the Openfire XMMP Server. It will work like WhatsApp and Facebook Messenger. So, You can also make video and audio calls through this application. In addition, You can also ban misbehavior in users’ accounts and IP addresses. Therefore, You have full control of your Android chat application using a web admin panel.
Contents of Article
Android Chat App Features
It’s most important to discuss Android application features that 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 the Android video chat application. There are a lot of free Projects available on GitHub with GNU General Public License v3.0.Therefore, We can do Modifications, and also free for commercial use. So, We will use the Android studio project as one of them. The most popular Android studio project links are given below.
Conversations ( Group and One To One Chat )
Xabber-Android ( Group and One To 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 the link and paste it into an Android studio like this.
Once our project is downloaded then we will change the Android chat app package name. In addition, You also need to change your database server domain name from the Config.Java file. So, the guideline is shown in the following screenshot.
Once our Android Project is completed, we need an Openfire XMPP Server to run the Android chat app. If you don’t know how to install the XMPP server on the 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 is 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 application. You need to install the following Plugins from the Plugins Option in the 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 Calls)
- 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 Chat Application
If you want to make a video call application in Android Studio. So, We need to install the Jingle Nodes Plugin. In addition, We also need to set up Jingle Nodes Ports. Therefore, the Ports setting is shown in the following screenshot.
Once you have the jingle nodes setting completed. Now, Your video call works properly. If any problem occurs 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 is 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