Skip to content

nihahawas/bluetooth-chat-application

Repository files navigation

πŸ“± QuickChat β€” Bluetooth Chat Application

quickchattt





Features Β· How to Run Β· How to Connect Β· Protocol Β· Permissions


πŸ“‹ Table of Contents


πŸ” Overview

QuickChat is an Android application that lets two smartphones communicate directly over Bluetooth Classic (RFCOMM) β€” completely offline, no Wi-Fi or mobile data needed. It works like a standard messaging app (WhatsApp-style UI) but over a direct Bluetooth connection.

Built as part of the CNDC assignment at SZABIST Islamabad, the app covers device discovery, real-time messaging, file transfer with progress tracking, delivery receipts, and message timestamps.


✨ Features

Feature Status
πŸ” Device Discovery β€” scan & list nearby Bluetooth devices βœ… Done
πŸ’¬ Real-Time Text Messaging β€” send & receive instantly βœ… Done
πŸ“ File Transfer β€” images, PDFs with live progress bar βœ… Done
🟒 Connection Status β€” connected / disconnected / scanning indicators βœ… Done
πŸ• Message Timestamps β€” time shown on every message bubble βœ… Done
βœ… Delivery Receipts β€” sender notified when message is received βœ… Done

πŸ›  Tech Stack

Component Technology
Language Kotlin
Platform Android (Native)
Bluetooth Bluetooth Classic β€” RFCOMM / SPP
Min SDK API 21 (Android 5.0+)
IDE Android Studio
UI XML Layouts

πŸ“ Project Structure

bluetooth-chat-application/
β”œβ”€β”€ .idea/                          ← Android Studio project settings
β”œβ”€β”€ app/                            ← Main application module
β”‚   └── src/
β”‚       └── main/
β”‚           β”œβ”€β”€ java/com/example/quickchat/
β”‚           β”‚   β”œβ”€β”€ MainActivity.kt        ← Chat UI + device discovery
β”‚           β”‚   └── BluetoothService.kt    ← Connection + data transfer
β”‚           β”œβ”€β”€ res/
β”‚           β”‚   β”œβ”€β”€ layout/
β”‚           β”‚   β”‚   └── activity_main.xml  ← Main UI layout
β”‚           β”‚   └── drawable/
β”‚           β”‚       └── bg_input.xml       ← Input field background
β”‚           └── AndroidManifest.xml        ← Permissions & app config
β”œβ”€β”€ gradle/                         ← Gradle wrapper files
β”œβ”€β”€ .gitignore                      ← Git ignored files
β”œβ”€β”€ README.md                       ← Project documentation
β”œβ”€β”€ build.gradle.kts                ← Project build config
β”œβ”€β”€ gradle.properties               ← Gradle properties
β”œβ”€β”€ gradlew                         ← Gradle wrapper (Linux/Mac)
β”œβ”€β”€ gradlew.bat                     ← Gradle wrapper (Windows)
β”œβ”€β”€ settings.gradle.kts             ← Project settings
β”œβ”€β”€ protocol design document.pdf   ← Protocol design document
└── quickchat.jpeg                  ← App screenshot

πŸš€ How to Run

Prerequisites

  • Android Studio Hedgehog or later
  • Two Android devices (API 21+) with Bluetooth support
  • USB cable for initial installation

Steps

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/QuickChat-Bluetooth.git
cd QuickChat-Bluetooth

2. Open in Android Studio

File β†’ Open β†’ Select the project folder

3. Sync Gradle

Android Studio will prompt automatically β€” click Sync Now

4. Build & Install on both devices

Run β–Ά β†’ Select your device β†’ OK

Repeat for the second device.


πŸ”— How to Connect & Chat

  1. Open QuickChat on both devices
  2. On Device A β†’ tap Scan to search for nearby devices
  3. On Device B β†’ make sure Bluetooth is ON and device is discoverable
  4. On Device A β†’ tap Device B's name from the list to connect
  5. Once connected β†’ type a message and tap Send ✈️
  6. To send a file β†’ tap the πŸ“Ž attachment button and pick a file

πŸ“‘ Protocol Design

πŸ“„ See the full Protocol Design Document for byte-level details, flow diagrams, and error handling.


Quick Summary

QuickChat uses a custom binary protocol over RFCOMM. Every packet has a 5-byte header followed by a variable-length payload:

[ TYPE (1 byte) ][ LENGTH (4 bytes) ][ PAYLOAD (LENGTH bytes) ]

Type Code Packet Name Purpose
0x01 TEXT_MESSAGE A chat text message
0x02 FILE_START Announces a file transfer with metadata
0x03 FILE_CHUNK One 4 KB piece of the file
0x04 FILE_END End of file + MD5 checksum for verification
0x05 ACK Delivery acknowledgement (success/failure)
0x06 PING Keep-alive signal

πŸ” Permissions

The following permissions are required and requested at runtime on Android 12+:

Permission Required For Android Version
BLUETOOTH Basic Bluetooth operations All versions
BLUETOOTH_ADMIN Device discovery & pairing All versions
BLUETOOTH_CONNECT Connecting to paired devices Android 12+
BLUETOOTH_SCAN Scanning for nearby devices Android 12+
ACCESS_FINE_LOCATION Bluetooth device discovery Android 6+
READ_EXTERNAL_STORAGE Picking files to send All versions

πŸŽ₯ Demo Video

πŸ“Ή Watch Demo Video

The demo shows:

  • Two real Android devices connecting over Bluetooth
  • Sending and receiving text messages in real time
  • Transferring a file with the progress bar

πŸ“š Assignment Info

Field Detail
Student Niha Hawas
Program BSCS-6B
Institute SZABIST Islamabad
Course CNDC β€” Computer Networks & Data Communications
Assignment Bluetooth Chat Application
Year 2026

πŸ‘¨β€πŸ’» Author

Developed by: Niha Hawas


Made with ❀️ by Niha Hawas β€” SZABIST Islamabad 2025

About

πŸ“± A real-time Bluetooth chat app for Android β€” send messages and transfer files between two devices over Bluetooth Classic, built with Kotlin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages