Package selection guidance compiled from public package information, community data, and project usage.
A Flutter plugin that detects whether a device's location is being simulated or faked. It leverages platform-specific APIs on Android and iOS to analyze location data for signs of spoofing, such as inconsistent GPS signals or unusual movement patterns. This helps apps verify the authenticity of user location, improving security and reliability in location-sensitive applications. The plugin is lightweight and integrates seamlessly into existing Flutter projects.
Use cases
Verifying user location in ride-sharing apps
Preventing fraud in geolocation-based services
Ensuring accuracy in fitness tracking apps
Securing access to location-restricted content
Detecting fake check-ins or location sharing
Key features
Cross-platform support for Android and iOS
Uses native device APIs for accurate detection
Lightweight and easy to integrate
Provides clear indicators of location spoofing
Minimal performance overhead
Suitable for
Apps requiring secure location verification
Developers building location-aware services
Applications with anti-fraud requirements
Mobile apps using real-time geolocation
Projects needing compliance with location integrity standards
Considerations
Requires appropriate permissions for location access
May not detect all advanced spoofing methods
Behavior may vary slightly between devices
Not a substitute for server-side validation
Limited effectiveness on rooted/jailbroken devices
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
detect_fake_location
This is a Flutter plugin that detects if the user is using a fake(mock or simulated) location on their device.
Installation
To use this plugin, add detect_fake_location as a dependency in your pubspec.yaml file.
Permissions
iOS
Add the following entries to your Info.plist file
<key>NSLocationAlwaysUsageDescription</key><string>App needs access to location when in the background.</string><key>NSLocationWhenInUseUsageDescription</key><string>App requires access to location when open.</string>
Add the following to your Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
# Start of the permission_handler configuration
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
# dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1'
]
end
end
end
Android
Add the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permission to your Android Manifest.
By default, the plugin detects fake locations from both software simulation and external accessories. However, external accessories like CarPlay, external GPS devices, or other legitimate hardware can trigger false positives.
Default:false (maintains backward compatibility)
When to use true: If you want to ignore location data from external accessories and only detect software-based fake locations
Use case: Prevent false positives when users have legitimate external accessories connected
For iOS, the plugin uses the CLLocationSourceInformation class to detect if the location is simulated by software or produced by an external accessory. This class is only available on iOS 15 or later.
Contribute
Contributions are welcome! Please submit issues and pull requests on the GitHub repository.