Detect mock location in flutter

1.7k views Asked by At

Hi I am trying to detect wether user is using fake gps or not using trust_location and geolocator package. For geolocator package, as I know it has property of isMocked. So, when I open my apps and then turning on the fake gps, it success to return true that user is using fake gps. But the problem is.... I will get different result when I turn on fake gps for the first, and the second I open my apps... it will return false. It means that the fake gps is not detected... Is there another way to detect mock location of user ?

1

There are 1 answers

0
T shuvo On

Your Geolocator must return a position object. From this object, you will find an option called isMocked. That will work perfectly for sure.

Position position = await Geolocator.getCurrentPosition( desiredAccuracy: gl.LocationAccuracy.high);

position.isMocked.

hope this will help you.