Skip to content
ArturKosPublic

About

Android app for real-time incoming caller identification via nieznany-numer.pl — uses BroadcastReceiver, overlay service, and phone state tracking

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

CallerID

An Android application that identifies unknown callers in real time by querying the nieznany-numer.pl database. When a call comes in, a draggable overlay displays the caller's community rating, search history, and user comments, with a one-tap option to reject negatively-rated calls.

Android Java Gradle API

Features

  • Real-time caller identification via BroadcastReceiver that intercepts PHONE_STATE intents when the phone rings
  • Floating overlay displayed on top of other apps, showing caller number, rating badge, and details while the phone is ringing
  • Community ratings with color-coded badges: positive (green), neutral (yellow), negative (red), and unknown (gray)
  • One-tap call rejection button that appears automatically for negatively-rated numbers, using TelecomManager on Android P+ with legacy reflection fallback
  • Draggable overlay that can be repositioned by touch during an active call
  • Persistent notification keeping the service alive in the background
  • Multi-language support with localized strings for English, Polish, French, and Russian
  • API integration fetching rating counts, search history, comment count, last-searched date, and user comments from the backend

Screenshots

Screenshot 1

Screenshot 2

Architecture

The app follows a receiver-service-provider pattern:

  1. PhoneStateReceiver -- A BroadcastReceiver registered for android.intent.action.PHONE_STATE. On RINGING, it extracts the incoming number and starts OverlayService. On IDLE or OFFHOOK, it stops the service.
  2. OverlayService -- Creates a TYPE_APPLICATION_OVERLAY window with the caller info layout. Handles drag gestures, close/reject buttons, and manages the overlay lifecycle.
  3. PhoneNumberProvider -- Performs an asynchronous HTTP GET to the API endpoint, parses the JSON response, and delivers rating, counts, and comments via a callback interface.
  4. MainActivity -- Handles permission requests (phone state, call log, overlay, answer calls), creates the notification channel, and shows a persistent notification.

Dependencies

Library Version Purpose
AndroidX AppCompat 1.7.1 Backward-compatible Activity and UI components
Material Components 1.13.0 Material Design theming
ConstraintLayout 2.2.1 Flexible layout manager
JUnit 4.13.2 Unit testing
Espresso 3.7.0 UI testing

Required Permissions

Permission Purpose
INTERNET Query the phone number lookup API
READ_PHONE_STATE Detect incoming calls
READ_CALL_LOG Access caller number on Android 9+
READ_PHONE_NUMBERS Read phone number details
SYSTEM_ALERT_WINDOW Display overlay on top of other apps
ANSWER_PHONE_CALLS Reject calls programmatically (Android 9+)

Building

Prerequisites

  • Android Studio (Arctic Fox or later)
  • JDK 8+
  • Android SDK with API level 36

Steps

git clone <repository-url>
cd CallerID

Open the project in Android Studio, sync Gradle, and run on a device or emulator.

Alternatively, build from the command line:

./gradlew assembleDebug

The APK will be located at app/build/outputs/apk/debug/.

Project Structure

CallerID/
├── app/
│   ├── build.gradle                          # App-level build configuration
│   ├── proguard-rules.pro                    # ProGuard rules
│   └── src/
│       ├── main/
│       │   ├── AndroidManifest.xml           # Permissions, receiver, service declarations
│       │   ├── java/com/example/nieznany_numer/
│       │   │   ├── MainActivity.java         # Entry point, permissions, notification channel
│       │   │   ├── PhoneStateReceiver.java   # BroadcastReceiver for call state changes
│       │   │   ├── OverlayService.java       # Floating window with caller info and controls
│       │   │   ├── PhoneNumberProvider.java  # Async API client for number lookup
│       │   │   └── Notification.java         # Notification activity
│       │   └── res/
│       │       ├── layout/
│       │       │   ├── activity_main.xml     # Main activity layout
│       │       │   ├── overlay_caller.xml    # Floating overlay layout
│       │       │   └── notification.xml      # Notification layout
│       │       ├── drawable/                 # Rating badges and overlay backgrounds
│       │       ├── values/                   # Default strings and themes
│       │       ├── values-en/                # English localization
│       │       ├── values-pl/                # Polish localization
│       │       ├── values-fr/                # French localization
│       │       └── values-ru/                # Russian localization
│       └── test/                             # Unit tests
├── settings.gradle
└── README.md

Configuration

The API endpoint is defined in PhoneNumberProvider.java:

private static final String API_BASE = "https://your-server.com/api/v1/numbers/";

Replace this URL with your own backend or a compatible phone number lookup API before building.

License

This project is provided as-is for educational purposes.

About

Android app for real-time incoming caller identification via nieznany-numer.pl — uses BroadcastReceiver, overlay service, and phone state tracking

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages