Mock Location Detector
April 16, 2026 · View on GitHub
An Android app that detects mock locations (GPS spoofing) using multiple techniques. Helps developers and privacy‑conscious users verify if the device’s location is genuine.
Features
- 🔍 Detects mock location through 4 different methods
- 📱 Modern UI built with Jetpack Compose
- 🧪 Shows detailed results for each detection technique
- 🔐 Handles location permissions gracefully
Detection Methods
The app runs the following checks when you tap Run Detection:
| Method | Description |
|---|---|
| AppOpsManager | Checks if any installed app has the ACCESS_MOCK_LOCATION permission and is allowed to inject mock locations. |
| Settings.Secure | Reads the deprecated mock_location system setting (non‑zero value indicates mock is enabled). |
| Location object | Inspects the current location obtained via FusedLocationProviderClient: • isFromMockProvider (deprecated)• isMock (API 31+)• extras bundle flag mockLocation |
| Hook detection | Verifies that common Location class fields (provider, extras, isMock) have not been tampered with via runtime hooks. |
Bypassing Detection
Detection can be reduced to zero by using the HideMockLocation Xposed module. To achieve this, ensure that you include System Framework and Settings Storage in the module's scope within your Xposed manager (e.g., LSPosed).
How It Works
- The app requests coarse/fine location permissions.
- When you press Run Detection:
- It checks all installed packages for mock location privileges (
AppOpsManager). - It reads the secure settings for the legacy
mock_locationflag. - It fetches the current location using Google Play Services’ FusedLocationProviderClient.
- It analyses the returned
Locationobject for mock indicators. - It performs hook detection by creating a test
Locationand verifying expected behaviour.
- It checks all installed packages for mock location privileges (
- Results are displayed in a scrollable list, with red icons indicating a mock location was detected.
Permissions
ACCESS_COARSE_LOCATION– approximate location for detection (balanced power/accuracy).ACCESS_FINE_LOCATION– precise location (required for high‑accuracy checks).QUERY_ALL_PACKAGES– needed to enumerate all installed apps and check their declared permissions.
The app does not store or transmit any location data. All processing is done on‑device.