GPS attendance for field teams

Detecting fake GPS during attendance

Updated · Author: Hadirly team

Fake GPS is hard to detect completely from a phone. Android lets an app recognise a location that comes from a mock location provider, and Hadirly uses that flag. The flag catches the common case, which is a fake location app running on an ordinary phone. It does not catch a device that has been modified at the system level, and it does not prove where the phone physically is.

What Android says

Android lets other apps send a mock location to LocationManager. Such a location can be recognised with the isMock() method on the Location object. Android’s documentation recommends isMock() from API level 31 onward. It replaces isFromMockProvider(), which is no longer recommended (Android Developers).

The same documentation notes that users can have legitimate reasons to use a mock location. For that reason, an app should reject mock locations only when that is essential to its function. Hadirly follows this approach: the flag is recorded, and a person reviews the record.

What Hadirly checks

  1. The app reads the mock location flag from every GPS fix.
  2. When the flag is set, the app shows “Fake location detected” and asks the employee to turn off the fake location app and try again. If the employee continues anyway, the record is saved.
  3. The flag value is signed together with the time, coordinates, and accuracy. The server checks that signature. If a value was changed after signing, the record is rejected as bad_signature.
  4. The server adds a mock_location flag, and the record’s status becomes flagged, not rejected.
  5. The server also checks other signs of an unusual location: impossible_travel when the speed between two records is over 250 km/h across a distance of at least 0.5 km from the previous record, plus low_accuracy and outside_geofence.

The signature confirms that the flag value was not changed after it was sent. It does not prove that the original value was correct. On a device that the user controls, the reported flag cannot be verified.

What the checks catch and miss

Signal Catches Does not catch
Android mock location flag Fake location apps running on an ordinary phone Modified devices that report a clean flag
Device signature Values changed after signing Fake values signed from the start
Travel jump Positions that move too fast Slow spoofing, or spoofing that stays in one place
Poor accuracy Very uncertain fixes Spoofing that reports good accuracy
Outside the area Positions far from the site A fake position already placed inside the radius

A flagged record means “needs a look”, not “definitely cheating”. An unflagged record does not mean its position is definitely correct either.

Limits to know about

  • On a rooted device, the mock location flag can be hidden.
  • Hadirly does not currently run Play Integrity checks or root detection, so it does not claim to confirm that a device is unmodified.
  • An employee who is somewhere else but uses a method that does not set the mock location flag will not be caught by this check.
  • A flag is only a hint. One flag is not enough to judge a person.

Checklist

  • The manager knows what each flag means, and does not decide from one flag alone.
  • Employees know that mock locations are recorded and reviewed.
  • There is a correction path for records that turn out to be valid.
  • Flagged records are reviewed regularly, for example every week.
  • For critical work sites, consider a second check outside the app.

What the manager sees

Flagged records appear in the review list with plain labels: “Suspected fake location”, “Outside site area”, or “GPS signal less accurate”. The manager records a decision with a note, and the decision is saved with the reviewer’s name and the time.

Why records are not rejected outright

A direct rejection could be wrong. A weak GPS signal inside a building can place an employee well away from their actual position. A mock location flag can also appear for a legitimate reason, as the Android documentation acknowledges. With a flag, the manager can look at each case and accept an explanation. A rejected record is not counted in reports, so the same kind of error would stop being visible.

Sources

  • Android Developers, Location class reference (isMock and isFromMockProvider methods).

Try Hadirly for 14 days

The trial needs no payment up front. Register, verify your email, then install the apps.

Frequently asked questions

Can Hadirly stop fake GPS completely?

No. Hadirly reads the mock location flag from Android and marks the record. The flag cannot prove where the phone physically is, especially on a device that has been modified.

Is an attendance record with fake GPS rejected right away?

No. The record is saved with a mock location flag and status flagged, so a manager can review it. Only a record whose signature does not match is rejected.

Is an extra app needed to detect fake GPS?

Not for this basic feature. A manager reviews flagged records, then uses a correction request when the employee gives a reasonable explanation.