smarques84/MockLocationDetector
smarques84/MockLocationDetector has 1,899 GitHub stars and 1,234 forks. GitHot measured +2 stars in 24 hours. Last checked 2026-11-08 00:58 UTC. Last push 2024-02-27.
An android library to help detect mock locations
Measured star growth
- in 24h
- +2
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalMockLocationDetector
An android library to help detect mock locations
Gradle
Add the next dependency to your gradle.build
compile 'com.inforoeste.mocklocationdetector:mock-location-detector:1.0.0'
Usage
From anywhere on your code just call the class MockLocationDetector to access the following available static methods
isLocationFromMockProvidercheckForAllowMockLocationsAppsisAllowMockLocationsOn
To detect if the location object you received is a mock just call the method isLocationFromMockProvider and pass
the context and the location object. This method only works on API 18+ if this method is called on lower apis it then
it will check if Allow Mock Locations is ON or not and return the result. This is the recomended method for most cases.
If you want to check if there are apps on the users phone that have "ALLOW_MOCK_LOCATIONS" permission on their
manifest just call checkForAllowMockLocationsApps. This method is usefull for apps that use root access to enable/disable
allow mock locations at runtime to try to fool other apps on lower apis (API 17 or lower). Also starting on Marshmallow its
no longer possible to enable/disable allow mock locations at runtime with root permissions.
Finally you can call isAllowMockLocationsOn to check if the system setting Allow Mock Locations is enabled or not. Be aware
that this method is deprecated and doesnt work on Marshmallow or up. If you call this method on API 23+ it will always return
false.
Sample
You can run the sample to test the library
License
Copyright 2016 Stéphane Marques
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
560,951 starspublic-apis/public-apis
A collective list of free APIs
497,211 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
442,709 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,183 stars