Mock location detection
final result = await DeviceShield.checkMockLocation();
final canReadLocation = result.locationPermissionGranted;The SDK never requests location permission. The location-based signals only work if your app already has it. See Android setup and iOS setup.
Android signals
Section titled “Android signals”| Signal | Check | Needs location permission |
|---|---|---|
mock_provider_flag |
The most recent known location (GPS, network or passive provider) is marked as coming from a mock provider | Yes |
impossible_velocity |
Moving faster than 300 m/s since the previous check (ignored if the fixes are under 3 s or 10 m apart) | Yes |
mock_app_selected_for_this_app |
The user selected this app as the mock-location app in developer options | No |
fake_gps_app_installed |
One of 10 known fake-GPS apps is installed | No |
legacy_allow_mock_location_setting |
The Allow mock locations setting is on (Android 5.x only) | No |
The strengths are on the Signals page.
iOS signals
Section titled “iOS signals”| Signal | Check | Needs location permission |
|---|---|---|
known_spoofing_tweak_artifact |
A known location-spoofing tweak or app is present (5 paths, jailbroken devices only) | No |
invalid_location_accuracy |
The last location reports a negative horizontal accuracy | Yes |
impossible_velocity |
Same rule as Android | Yes |
What the check could see
Section titled “What the check could see”MockLocationResult adds two fields:
| Field | Meaning |
|---|---|
locationPermissionGranted |
Your app has location permission, so location signals could run |
locationAvailable |
A location was actually available to inspect |
The first impossible_velocity check only records a location. Speed can be
compared from the second check onwards, within the same app process.