Skip to content
deaversPublic

About

πŸ“¦ Android inventory scanner app β€” scan items by inventory number using Google ML Kit OCR, REST API backend with MariaDB. Diploma project 2022.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

39 Commits

Folders and files

Repository files navigation

πŸ“¦ Inventory Scanner β€” Android Mobile Application

A mobile application for scanning, recognizing, and counting inventory objects using AI (Google ML Kit) and a REST API backend.


πŸ“– About the Project

Inventory Scanner is an Android application developed as a diploma project at Ust-Kamenogorsk Higher Polytechnic College (2022). The application is designed for employees of organizations (warehouses, schools, enterprises) who need to conduct asset inventory efficiently.

Instead of manually typing inventory numbers, users can photograph or scan an item's inventory tag β€” the AI automatically recognizes the number and searches it against a remote database, then generates an inventory report.


✨ Features

Feature Description
🏫 Room Selection Choose a classroom or department from the server database
πŸ” Smart Search Live search by inventory number within a room or across the global database
πŸ“· AI Scanner Recognize inventory numbers from a photo (camera or gallery)
βœ… Object Marking Mark found items as checked during the inventory session
πŸ“Š Report Generation Generate and save an inventory report to device storage
🌐 REST API Sync All data is synced with a remote MariaDB server via HTTP

πŸ—οΈ Architecture

The application uses a 2-tier client-server architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         HTTP (REST API)        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Android Client   β”‚  ──────────────────────────►   β”‚    Remote Server    β”‚
β”‚  (Kotlin + ML Kit) β”‚  ◄──────────────────────────   β”‚  MariaDB + PHP API  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Client: Android app (Kotlin, XML layouts)
  • Server: Hosted on Gohost.kz, database managed via phpMyAdmin
  • Communication: REST API using HTTP methods (GET, POST, PUT, DELETE)
  • AI: Google ML Kit (on-device text recognition, no cloud dependency for basic scanning)

πŸ—„οΈ Database Schema (3NF)

Classrooms          Categories          Items
──────────────      ──────────────      ──────────────────────────
num (PK)            id (PK)             inventory_num (PK)
name                name                name
                                        category_id (FK β†’ Categories)
                                        class_room_num (FK β†’ Classrooms)
                                        created_at
                                        updated_at

πŸ“± Screens & Navigation

SplashScreen
    β”‚  (permission check + internet check)
    β–Ό
MainActivity (Home)
    β”‚  BottomNav: [🏠 Home] [πŸ” Search]
    β”œβ”€β”€ HomeFragment β€” classroom list from server
    β”‚       β”‚
    β”‚       β–Ό
    β”‚   SearchFragment β€” items list for selected room
    β”‚       β”œβ”€β”€ πŸ” Live search (room β†’ global DB)
    β”‚       β”œβ”€β”€ πŸ“· Scanner β†’ ScannerActivity
    β”‚       └── πŸ“Š Report β†’ CartListActivity
    β”‚
    └── ScannerActivity β€” camera / gallery + crop + ML Kit OCR

πŸ› οΈ Tech Stack

Layer Technology
Language Kotlin (primary), Java, XML
IDE Android Studio
AI / ML Google ML Kit β€” Text Recognition
Networking REST API over HTTP/HTTPS
Database MariaDB (remote), phpMyAdmin
Architecture 2-Tier Client-Server, MVVM (ViewModel)
Min SDK Android 8.0 (API Level 26)

πŸ“‹ System Requirements

Device Requirements

Parameter Minimum
Android version 8.0 (Oreo) or higher β€” API Level 26
RAM 1.5 GB or more
Free storage 800 MB or more
Screen resolution 1080 Γ— 1920 px (FHD)
CPU frequency 1.6 GHz or higher
CPU cores 2 or more
Internet Required (for DB sync and ML Kit cloud fallback)

Permissions Required

  • CAMERA β€” for scanning inventory tags
  • READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE β€” for gallery access and report saving
  • INTERNET β€” for REST API communication

πŸ“‚ Project Structure

app/
β”œβ”€β”€ manifests/
β”‚   └── AndroidManifest.xml          # App config, permissions, components
β”œβ”€β”€ java/
β”‚   β”œβ”€β”€ MainActivity.kt              # Main entry screen
β”‚   β”œβ”€β”€ SplashScreen.kt             # Splash + permission check
β”‚   β”œβ”€β”€ ScannerActivity.kt          # Camera/gallery scan + ML Kit OCR
β”‚   β”œβ”€β”€ CartListActivity.kt         # Report screen (marked items)
β”‚   β”œβ”€β”€ HomeFragment.kt             # Classroom list fragment
β”‚   β”œβ”€β”€ SearchFragment.kt           # Item search + scan trigger
β”‚   β”œβ”€β”€ ConnectionDetector.kt       # Internet connectivity check
β”‚   β”œβ”€β”€ HomeViewModel.kt            # ViewModel for HomeFragment
β”‚   β”œβ”€β”€ ScanViewModel.kt            # ViewModel for ScannerActivity
β”‚   β”œβ”€β”€ SearchViewModel.kt          # ViewModel for SearchFragment
β”‚   β”œβ”€β”€ adapters/                   # RecyclerView adapters
β”‚   β”œβ”€β”€ data/                       # REST API (Retrofit/HTTP) calls
β”‚   β”œβ”€β”€ domain/                     # Data models (Classroom, Item, Category)
β”‚   β”œβ”€β”€ interfaces/                 # Click listeners, UI interfaces
β”‚   └── utils/                      # Constants and utility functions
└── res/
    β”œβ”€β”€ layout/                     # XML screens (6 screens + templates)
    β”œβ”€β”€ drawable/                   # Icons, vector graphics
    β”œβ”€β”€ font/                       # 4 custom fonts
    β”œβ”€β”€ mipmap/                     # App launcher icons
    β”œβ”€β”€ values/                     # Colors, themes, strings
    └── xml/                        # Backup rules, file paths

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/deavers/InvScan.git
cd InvScan

2. Open in Android Studio

Open the project folder in Android Studio (Flamingo or newer recommended).

3. Configure the API endpoint

In utils/Constants.kt (or equivalent), set your server base URL:

const val BASE_URL = "https://your-server.com/api/"

4. Set up the database

Import the SQL schema into your MariaDB server using phpMyAdmin:

CREATE TABLE classrooms (num VARCHAR(20) PRIMARY KEY, name VARCHAR(100));
CREATE TABLE categories (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100));
CREATE TABLE items (
    inventory_num VARCHAR(50) PRIMARY KEY,
    name VARCHAR(200),
    category_id INT,
    class_room_num VARCHAR(20),
    created_at DATETIME,
    updated_at DATETIME,
    FOREIGN KEY (category_id) REFERENCES categories(id),
    FOREIGN KEY (class_room_num) REFERENCES classrooms(num)
);

5. Build & Run

# Via Android Studio: Run β–Ά or
./gradlew assembleDebug

🧠 How ML Kit Text Recognition Works

  1. User takes a photo or selects from gallery
  2. The image is cropped to the region of interest
  3. Google ML Kit processes the image on-device:
    • If confidence β‰₯ 70% β†’ result accepted
    • If confidence < 70% β†’ fallback to Google Cloud ML Kit
    • If still < 70% β†’ closest match is used
  4. Recognized number is searched in the room DB, then the global DB
  5. Result is displayed with item info and category

Average recognition time: ~1 second (varies by device and image quality)


πŸ“„ Report Format

Generated reports are saved to device storage as files named:

[RoomName]_[YYYY-MM-DD].xlsx / .txt

Report contents:

  • Room full name
  • Total items in room
  • Number of marked (checked) items
  • All inventory numbers with βœ… / ❌ status per item

πŸ”Œ REST API Endpoints

Method Endpoint Description
GET /classrooms Get all classrooms
GET /items?room={num} Get items for a specific room
GET /items/{inventory_num} Search item globally
POST /items Add new item
PUT /items/{inventory_num} Move item to another room
DELETE /items/{inventory_num} Remove item

πŸ‘€ Author

Sairakhan Shynggys Diploma Project β€” Ust-Kamenogorsk Higher Polytechnic College
Specialty: Computer Engineering and Software
Group: 18-VT-2 | Year: 2022


πŸ”— Related Projects

This app requires a running backend server to function.

Repository Description
BaseInvScan Laravel REST API backend β€” provides inventory items, classrooms and categories

To run the full project, clone and start BaseInvScan first, then update BASE_URL in the app's constants file before building.

πŸ“œ License

This project was developed as an educational diploma project.

About

πŸ“¦ Android inventory scanner app β€” scan items by inventory number using Google ML Kit OCR, REST API backend with MariaDB. Diploma project 2022.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages