Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

MonkeyBytes-Hosting/android-app

Repository files navigation

Pager Messaging System

Complete self-hosted messaging system with web dashboard and Android app. Send messages to Android devices via WebSocket with no Firebase or external dependencies.

System Architecture

┌─────────────────────────┐
│   Web Dashboard         │  React + Node.js + Socket.IO
│   Port 3000            │  Send messages, view devices
└───────────┬─────────────┘
            │ WebSocket
            ↓
┌─────────────────────────┐
│   Android Backend       │  (External Service)
│   Port 3004            │  WebSocket broadcast + REST API
└───────────┬─────────────┘
            │ WebSocket
            ↓
┌─────────────────────────┐
│   Android App           │  Kotlin + Jetpack Compose
│   Mobile Devices       │  Receive messages, notifications
└─────────────────────────┘

Components

1. Web Dashboard (web/)

  • Frontend: React 18 + Vite + Tailwind CSS
  • Backend: Node.js + Express + Socket.IO
  • Features:
    • Send messages to devices
    • Real-time device status
    • Message history with delivery tracking
    • WebSocket for instant updates

2. Android App (android-app/)

  • Tech: Kotlin + Jetpack Compose + Material 3
  • Features:
    • Real-time message reception via WebSocket
    • Local push notifications (no FCM)
    • Room database for offline storage
    • Delivery and acknowledgment confirmations

Quick Start

Option 1: Use Root Startup Script

# From web directory
cd web
node server.js

# Or use npm
npm start

Option 2: Manual Startup

# Start web dashboard
cd web/backend
npm install
npm start

# Build Android app
cd android-app
./gradlew assembleDebug
adb install app/build/outputs/apk/debug/app-debug.apk

See QUICKSTART.md for detailed instructions.

Documentation

Features

Web Dashboard

✓ Send messages to multiple devices ✓ Real-time device monitoring ✓ Message history with status tracking ✓ WebSocket for instant updates ✓ No polling required ✓ Clean Material UI

Android App

✓ Real-time message reception ✓ Local push notifications ✓ Offline message storage ✓ Delivery confirmations ✓ Acknowledgment system ✓ Material 3 design

Configuration

Web Dashboard

  • Server: https://test.bot.monkey-network.xyz:3000
  • Android Backend: https://test.bot.monkey-network.xyz:3004
  • Config file: web/backend/.env

Android App

  • Backend URL: https://test.bot.monkey-network.xyz:3004
  • Min SDK: 24 (Android 7.0)
  • Target SDK: 34 (Android 14)

Project Structure

.
├── web/                       # Web Dashboard
│   ├── server.js             # Root startup script
│   ├── package.json          # Root package configuration
│   ├── frontend/             # React application
│   │   ├── src/
│   │   │   ├── components/   # React components
│   │   │   ├── hooks/        # Custom hooks (WebSocket)
│   │   │   └── App.jsx       # Main app
│   │   ├── package.json
│   │   └── vite.config.js
│   └── backend/              # Node.js server
│       ├── src/
│       │   ├── routes/       # API routes
│       │   └── server.js     # Express + Socket.IO
│       ├── package.json
│       └── .env              # Configuration
│
├── android-app/               # Android Application
│   ├── app/
│   │   ├── src/main/
│   │   │   ├── java/com/pager/app/
│   │   │   │   ├── data/     # Data layer
│   │   │   │   │   ├── local/      # Room database
│   │   │   │   │   ├── remote/     # API + WebSocket
│   │   │   │   │   └── models/     # Data models
│   │   │   │   ├── ui/       # UI layer
│   │   │   │   │   ├── screens/    # Compose screens
│   │   │   │   │   ├── components/ # UI components
│   │   │   │   │   └── theme/      # Material theme
│   │   │   │   ├── viewmodel/      # ViewModels
│   │   │   │   └── MainActivity.kt
│   │   │   ├── AndroidManifest.xml
│   │   │   └── res/          # Resources
│   │   └── build.gradle.kts
│   ├── build.gradle.kts
│   └── settings.gradle.kts
│
├── QUICKSTART.md              # Quick start guide
├── DEPLOYMENT_GUIDE.md        # Detailed deployment
└── README.md                  # This file

Installation

Prerequisites

  • Node.js 18+
  • Android Studio
  • Android device (API 24+)

Install Web Dashboard

cd web

# Install all dependencies
npm run install-all

# Or install separately
cd frontend && npm install
cd ../backend && npm install

Build Frontend

cd web
npm run build
# Or: cd frontend && npm run build

Build Android App

cd android-app
./gradlew assembleDebug

Running

Start Web Dashboard

cd web
node server.js
# Or: npm start

Server runs at: https://test.bot.monkey-network.xyz:3000

Install Android App

cd android-app
adb install app/build/outputs/apk/debug/app-debug.apk

Testing

Send Test Message

  1. Open Web Dashboard
  2. Device should appear in device list
  3. Select device
  4. Enter message:
    • Title: "Test"
    • Body: "Hello from dashboard"
    • Priority: Normal
  5. Click "Send Message"
  6. Check Android device for notification

Verify Real-time Updates

  1. Send message from dashboard
  2. Watch message status update in real-time:
    • Pending (Yellow) → Delivered (Blue) → Acknowledged (Green)
  3. No page refresh needed

API Endpoints

Web Dashboard Backend

POST   /api/send              Send message to devices
GET    /api/devices           Get all devices
GET    /api/messages          Get message history
DELETE /api/devices/:id       Delete device

Android Backend (External)

POST   /api/v1/devices/register              Register device
POST   /api/v1/messages                      Send message
POST   /api/v1/messages/:id/delivered        Mark delivered
POST   /api/v1/messages/:id/acknowledged     Mark acknowledged
GET    /api/v1/devices                       Get devices
GET    /api/v1/messages                      Get messages
DELETE /api/v1/devices/:id                   Delete device

WebSocket Events

Dashboard → Backend → Android Backend

// Dashboard connects to Backend
socket.connect()

// Backend connects to Android Backend
androidBackendSocket.connect()

Android Backend → Dashboard

socket.on('message_delivered', (data) => {
  // Message was delivered to device
})

socket.on('message_acknowledged', (data) => {
  // Message was acknowledged by user
})

socket.on('device_status_changed', (data) => {
  // Device came online/offline
})

Android Backend → Android App

socket.on("new_message") { args ->
  // New message received
  // Show notification
  // Save to database
  // Send delivery confirmation
}

Technology Stack

Web Dashboard

  • React 18
  • Vite
  • Tailwind CSS
  • Socket.IO Client
  • Axios
  • Node.js
  • Express
  • Socket.IO Server

Android App

  • Kotlin 1.9+
  • Jetpack Compose
  • Material 3
  • Socket.IO Client for Android
  • Retrofit
  • Room Database
  • Coroutines

Security

  • HTTPS for all communication
  • WebSocket over TLS
  • No Firebase or external services
  • Self-contained architecture
  • Local data storage

Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Android Support

  • Min SDK: 24 (Android 7.0)
  • Target SDK: 34 (Android 14)
  • Tested on Android 8-14

Troubleshooting

Web Dashboard not connecting

# Check backend is running
curl https://test.bot.monkey-network.xyz:3004/api/v1/devices

# Restart server
cd web
node server.js

Android app not receiving

# Check WebSocket connection
adb logcat | grep SocketManager

# Reinstall app
adb uninstall com.pager.app
adb install app/build/outputs/apk/debug/app-debug.apk

Build issues

# Web: Clean install
cd web
rm -rf frontend/node_modules backend/node_modules
npm run install-all

# Android: Clean build
cd android-app
./gradlew clean
./gradlew assembleDebug

Deployment

See DEPLOYMENT_GUIDE.md for:

  • Production deployment
  • SSL certificate setup
  • Performance optimization
  • Security hardening
  • Monitoring and logging
  • Backup strategies

Development

Run in Development Mode

Frontend:

cd web/frontend
npm run dev
# Runs on http://localhost:5173

Backend:

cd web/backend
npm start
# Runs on port 3000

Android:

cd android-app
# Open in Android Studio
# Click "Run" button

Contributing

This is a private project for internal use.

License

Private use only. All rights reserved.

Support

For issues or questions:

  1. Check QUICKSTART.md
  2. Review DEPLOYMENT_GUIDE.md
  3. Check component READMEs:
  4. Review logs for errors

Credits

Built with:

  • React
  • Node.js
  • Socket.IO
  • Kotlin
  • Jetpack Compose
  • Material Design

Version: 1.0.0 Last Updated: 2025

Enjoy your self-hosted messaging system! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published