Skip to content

ak0586/phoneguard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ PhoneGuard β€” Anti-Theft & Remote Recovery Suite

PhoneGuard is a professional-grade Android security application built with Flutter and native Kotlin. It protects your device against theft and gives you complete remote control over it via SMS β€” even when the app is closed, the phone is restarting, or the thief has turned off GPS.


πŸ“‹ Table of Contents


πŸš€ Core Features

Feature Description
πŸ“© SMS Remote Control Trigger recovery actions from any phone via secret keyword
πŸ“ 3-Tier GPS Fallback Location works even with GPS turned off
πŸ”” Remote Alarm Bypass-silent loud alarm triggered via SMS
πŸ›°οΈ Live Tracking Continuous real-time GPS updates via SMS
πŸ”’ Remote Lock Lock device via SMS using Device Admin API
πŸ”„ Boot Sync Auto-syncs device state to cloud on every power-on
πŸ’€ Shutdown Sync Captures final location and IP before power-off
🌐 Dashboard Real-time cloud dashboard showing device status
πŸ‘₯ Trusted Contacts Whitelist contacts from phonebook or manual entry
🎯 SIM Change Alert Instant SMS alert when SIM card is swapped
πŸ“Š Activity Logs Full log of all remote commands received

πŸ“© SMS Remote Control & Command System

PhoneGuard listens for SMS commands silently in the background without any visible notification. All commands use a customizable trigger keyword.

Command Format

<trigger_keyword> [pin] [action]

Examples

SMS Sent Result
miss you phone Executes all default actions (location + alarm + tracking + lock)
miss you phone location Sends current GPS location link
miss you phone alarm Starts loud bypass-silent alarm
miss you phone stop Stops alarm and tracking
miss you phone lock Remotely locks the device
miss you phone tracking Starts live location tracking
miss you phone 1234 location PIN-protected location request

Security Layers

  • βœ… Only Trusted Numbers can trigger commands
  • βœ… Optional PIN code for extra verification
  • βœ… Protection eligibility check before every command (trial / ad / subscription)
  • βœ… Dual-layer SMS detection β€” works even when a messaging app is open and intercepts the broadcast

Dual-Layer Detection (Bypass Proof)

PhoneGuard uses two independent systems to detect incoming trigger messages:

  1. SmsReceiver (Priority 1000) β€” Standard Android broadcast receiver registered at maximum priority, fires first before any other app.
  2. ContentObserver on content://sms/inbox β€” Watches the SMS database directly at OS level. Cannot be blocked by abortBroadcast() from messaging apps. Activates automatically when the user has a chat open in their messaging app.

πŸ“ Smart Location Tracking β€” 3-Tier GPS Fallback

This is PhoneGuard's most important anti-theft feature. Most phone trackers fail when a thief turns off GPS. PhoneGuard does not.

How It Works

When a location is requested (via SMS trigger, on startup, or on shutdown), PhoneGuard tries three methods in sequence:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Tier 1: High-Accuracy GPS (10s timeout)            β”‚
β”‚  β€’ Most precise (1–10 metre accuracy)               β”‚
β”‚  β€’ Requires GPS to be ON                            β”‚
β”‚  β€’ Label: "πŸ“ Location: <Google Maps link>"         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ GPS off or timed out?
                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Tier 2: Network Location / Cell Towers (8s timeout)β”‚
β”‚  β€’ Uses Wi-Fi networks + mobile cell towers         β”‚
β”‚  β€’ Works WITHOUT GPS (50–200 metre accuracy)        β”‚
β”‚  β€’ Label: "πŸ“Approx. Location (GPS off): <link>"   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ No network? Still failing?
                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Tier 3: Last Known Location (instant)              β”‚
β”‚  β€’ Uses the last position cached by the Android OS  β”‚
β”‚  β€’ Always available, may be minutes/hours old       β”‚
β”‚  β€’ Label: "πŸ“Approx. Location (GPS off): <link>"   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ Nothing at all?
                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Final: "πŸ“ Location unavailable β€” GPS & Network   β”‚
β”‚          both off"                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

When Location is Sent

  • On SMS trigger β€” immediately when the trigger keyword is received
  • On device startup β€” as soon as the phone boots and connects to internet
  • On device shutdown β€” final snapshot captured before power-off
  • During live tracking β€” periodic updates while tracking service is running

Location Data Stored in Cloud (Firestore)

Every location update also pushes the following to the owner's Firestore dashboard:

  • lastLatitude / lastLongitude
  • locationUpdatedAt
  • lastIp β€” current network IP address (useful for tracing Wi-Fi router location)
  • deviceModel β€” e.g., "OnePlus CPH2693"
  • osVersion β€” e.g., "Android 14 (SDK 34)"
  • isOnline β€” true/false
  • lastActive β€” server timestamp

πŸ”„ Native Background Security

All critical security operations run natively in Kotlin, completely independent of the Flutter engine. This means they work even if:

  • The app is closed
  • The phone just restarted
  • The Flutter engine hasn't loaded yet

Boot Sync (RecoveryService + BootReceiver)

  • Triggered automatically on every BOOT_COMPLETED / LOCKED_BOOT_COMPLETED
  • Pushes isOnline=true, lastIp, deviceModel, osVersion, and location to Firestore
  • Uses START_STICKY to survive system process restarts

Shutdown Sync (ShutdownReceiver)

  • Intercepts ACTION_SHUTDOWN and QUICKBOOT_POWEROFF broadcasts
  • Uses goAsync() to stay alive during the shutdown window
  • Pushes final location, IP, and isOnline=false to Firestore before power-off

SIM Change Detection (SimChangeReceiver)

  • Detects when the SIM card is removed or replaced
  • Sends an SMS alert to all trusted numbers with the new SIM information

πŸ‘₯ Trusted Number Management

  • Add numbers directly from the phone's contact book (with contact picker)
  • Add numbers manually via keyboard for numbers not in contacts
  • Intelligent number matching β€” handles all real-world phone number formats:
    • 9760638280 ↔ +919760638280 βœ…
    • 09165939300 ↔ +919165939300 βœ…
    • Local formats (e.g. 0XXXXXXXXXX) ↔ International formats (+CC XXXXXXXXXX) βœ…
    • Uses 4-strategy fuzzy matching: exact, suffix, adaptive-last-N, bidirectional suffix

πŸ’³ Protection & Subscription System

Plan Duration How
Free Trial 3 days Automatic on first login
Ad-Extended +8 hours per ad Watch rewarded ad
Premium (Monthly) 30 days In-app subscription
Premium (Yearly) 365 days In-app subscription
  • Live countdown timer on dashboard β€” shows HH:MM:SS when less than 24 hours remain
  • Protection expiry is stored immediately to SharedPreferences so native background services always have the correct state
  • On expiry, SMS commands return: "⚠️ PhoneGuard: Protection Expired. Please watch an ad or buy a subscription in the app to re-enable remote commands."

πŸ”’ Device Security

  • Remote Lock β€” Locks the screen via Android DevicePolicyManager (requires Device Admin activation)
  • Loud Alarm β€” Plays maximum-volume alarm that bypasses silent/DND mode
  • Stop Command β€” Remotely silences alarm and stops tracking via SMS

πŸ“Š Dashboard & Activity Logs

  • Real-time device status β€” Online/offline, last seen, location, IP, model, OS
  • Protection status card β€” Live countdown timer, current plan, extend protection button
  • Activity logs β€” Full history of every remote command received, with sender, timestamp, command, and result
  • Trusted Numbers list β€” View, add, and remove trusted contacts

πŸ—οΈ Architecture

lib/
β”œβ”€β”€ domain/          # Models, repository interfaces
β”œβ”€β”€ data/            # Firebase, Hive, SharedPreferences data sources
β”œβ”€β”€ presentation/    # Flutter UI (screens, providers, widgets)
└── core/            # Theme, utilities

android/app/src/main/kotlin/com/kyvronix/phoneguard/
β”œβ”€β”€ MainApplication.kt       # Firebase init before Flutter engine
β”œβ”€β”€ sms/
β”‚   β”œβ”€β”€ SmsReceiver.kt       # Priority-1000 broadcast receiver
β”‚   β”œβ”€β”€ CommandParser.kt     # Full command parsing, number matching, action execution
β”‚   └── SmsSender.kt         # Dual-SIM SMS sending
β”œβ”€β”€ location/
β”‚   └── LocationManager.kt   # 3-tier GPS fallback
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ RecoveryService.kt   # Boot sync + ContentObserver SMS bypass
β”‚   β”œβ”€β”€ TrackingService.kt   # Live location tracking
β”‚   └── AlarmService.kt      # Loud alarm
β”œβ”€β”€ receivers/
β”‚   β”œβ”€β”€ BootReceiver.kt      # Boot detection
β”‚   β”œβ”€β”€ ShutdownReceiver.kt  # Shutdown snapshot
β”‚   └── SimChangeReceiver.kt # SIM swap detection
└── security/
    └── DeviceAdminReceiver.kt  # Remote lock

State Management: Provider pattern
Local Storage: Hive (structured) + SharedPreferences (native-Flutter bridge)
Cloud: Firebase Firestore (real-time sync) + Firebase Auth
Language: Flutter/Dart (UI) + Kotlin (native security layer)


βš™οΈ Setup & Installation

Prerequisites

  • Flutter 3.x
  • Android Studio / VS Code
  • Firebase project with Firestore and Authentication enabled
  • Android device (API 26+)

Steps

git clone <repo-url>
cd phoneguard
flutter pub get
flutter run

Required Permissions (Granted at Runtime)

  • RECEIVE_SMS / READ_SMS / SEND_SMS
  • ACCESS_FINE_LOCATION / ACCESS_BACKGROUND_LOCATION
  • READ_CONTACTS
  • READ_PHONE_STATE
  • FOREGROUND_SERVICE
  • Device Administrator (for remote lock)

πŸ“„ License

This project is proprietary software developed by Kyvronix. All rights reserved.


PhoneGuard β€” Because your phone knows where it's been, even when you don't.

About

πŸ›‘οΈ PhoneGuard β€” Recover your stolen phone via SMS. Remotely track location, trigger alarms, and lock your device β€” all without internet on the protected phone. Built with Flutter & native Kotlin.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors