IT Development Blog

We chat application for Android

How to Build an Android Group Chat Application  April 21, 2025 – 03:02 am

pubchatIn this blog post, we’ll walk you through how to build an Android group chat application with a number of different core chat features. We’ll cover how to build:

  • Basic messaging for multi-user group chat
  • Presence: ie. the ‘buddy list’ (live online/offline status of connected users)
  • History: stores and retrieves messages
  • Push notifications

In the end, you’ll have something that looks like the sample image below. Check out the .

Project Details

Our Android group chat app allows a user to create a login identity that is then stored inSharedPreferences until logout. The initial chat room is titled MainChat, but a user can change chat rooms at any time.

An integer in the menu bar indicates how many users are in the current chat room. If you click that here now number, a modal with all users in the room is displayed. Clicking on a user in the herenow modal will display the login time of the corresponding user.

pubchat_hn_modalClicking on a message in the chat room will send a poke to that user, notifying them that you are in the chat room.

Core Chat Messaging

When a user sends a message, the code creates a ChatMessage object that holds the username, message text, and timestamp for the given message. ChatMessages are then serialized into a JSONObject and published to all users on the current channel via PubNub.

Next, a message is received using PubNub’s subscribe method. The JSONObject is deserialized back into a ChatMessage and added to a list of messages from the current chat room.

Realtime User Online/Offline List

If a user is online, a green dot is displayed next to their name. Join and Leave events are updated in realtime as well, so when a user logs off, you are notified immediately.

Presence updates the number of users currently in a room, but when you want to see the users currently in the chat, hereNow is used. A modal opens and is populated with the users currently subscribed to the chat room. Clicking on a user will tell you their login time, and the modal can be dismissed by clicking done.

Historic Messages

To store and retrieve historic chat messages, Storage & Playback is used. When a user opens the Android group chat app and is sent to MainChat, or when a user changes rooms, a call to PubNub’s history function loads the last 100 messages from the current channel so you know what other users have been talking about when you join.

Last Login

The PubNub State API allows you to define state data on the current channel. You can attach an object to your UUID that is accessible to anyone on the channel. This chat app uses the state API to attach login time to all online users’ UUIDs. When a user in the here now modal is clicked, their login time is read from the state of the channel and displayed in a Toast message.

Push Notifications

Enable push notifications on a channel and attach your GCM device ID to that channel and you are all set to receive pushes. When you tap a user’s message in a chat room, a PubNub push notification is sent through GCM protocols to notify the user that you are waiting for them.

Source: www.pubnub.com

The Idea Monk We Chat (Parenting)
Mobile Application (The Idea Monk)
  • Features:
  • Regularly updated articles
  • Favourite the articles that you like
  • Search with key words
  • Pinch zoom pictures
  • In-App Youtube viewer
  • Move to SD card

You might also like:

How to Create Realtime Chat Application in Android: part5
How to Create Realtime Chat Application in Android: part5
Video Chat for Android in 30 Lines of Code
Video Chat for Android in 30 Lines of Code
Android tutorial for beginners - 102 - Chat Bubble
Android tutorial for beginners - 102 - Chat Bubble ...
Gonext Info Solutions MKS Staff
Mobile Application (Gonext Info Solutions)
  • We would like to introduce to you the professional App for schools - My kidzschool . where your Staff can update the progress of their student on the spot meanwhile...
  • Features,
  • - Homewrok
  • - Attendance
  • - Results
  • - Exam timetable
  • - Two way chat between staff and parents
miniVNA application for Android - newer version (0.2)
miniVNA application for Android - newer version (0.2)
WeChat for Android (How to Create WeChat Account)(微信)
WeChat for Android (How to Create WeChat Account)(微信)
Chat Application android
Chat Application android
SecureO SecureO
Mobile Application (SecureO)
  • This app is created so people can easily chat with each other privately and securely without worrying about little snoopers that hacks into personally information...
  • Our app is beautiful and intuitive to use. Every menu are options are placed where it should be to make the chatting experience a breeze. We offer group chat where...
  • We use your mobile numbers to verify your identity and to find each other through mobile numbers. We send you a one time text to your phone and you just need to...
  • If you have any questions or bugs please report them to our contact page on our website at: http://SecureO.tk
chattingstickers Funny Whats App Stickers
Mobile Application (chattingstickers)
  • Features:
  • 1. You can choose from 30 different stickers
  • 2. Easy to use interface
  • 3. Share this application through whatsapp, we chat, SMS, Gmail, face book, etc. on your phone and help your contacts express their moods in a funny way
WhatsApp, Inc. WhatsApp
Mobile Application (WhatsApp, Inc.)
  • messaging
  • group chat
  • images, audio, video

Related posts:

  1. Free Internet application for Android
  2. File Manager application for Android
  3. Fitness Applications for Android
  4. Magic Jack application for Android
  5. Bible application for Android