wongpiwat / trust-location

A Flutter plugin for detecting mock location on Android device. (Supports only high accuracy location mode)
https://pub.dev/packages/trust_location
BSD 3-Clause "New" or "Revised" License
15 stars 8 forks source link

After permission mock status coming wrong. #9

Open Shivamtruein opened 4 years ago

Shivamtruein commented 4 years ago

I am using this in my project. I am using a plugin Location for getting location and this for detecting mock. After providing the location access to the app for the very first time plugin returns true even though there is no mock location app running. After that, it runs correctly but every time permission is requested this code returns true.

Code I am using :

TrustLocation.isMockLocation.then((value) { if (value) { showToast("Mock location enabled, Attendance not allowed", duration: Toast.LENGTH_LONG, gravity: Toast.CENTER); Navigator.of(context).pop(); } }).catchError((onError) {});

Flutter version 1.17.1 in use.

edrick27 commented 4 years ago

I have the seem problem

wahyu-handayani commented 4 years ago

me too, I have same problem

wongpiwat commented 4 years ago

Thanks for reporting the problem.

Android have 3 types of accuracy. reference High accuracy = All possible providers (WiFi, Mobile networks, GPS) GPS = Only GPS. Battery saving = WiFi and Mobile network.

This plugin only supports high accuracy, you have to enable high accuracy location on settings before check mock location. read more

sittichai4559 commented 3 years ago

Me too, I have same problem.

isoneday commented 1 year ago

any other solution ?

1bnunugroho commented 1 year ago

is there any solution for this issue?

edwinmacalopu commented 1 year ago

other alternatives that are working https://pub.dev/packages/safe_device (null safety) https://pub.dev/packages/fake_gps_detector

fahmisatrio commented 1 year ago

other alternatives that are working https://pub.dev/packages/safe_device (null safety) https://pub.dev/packages/fake_gps_detector

safe_device is dependent with this library when checking Mock Location in Android platform. And you will get same result. i found similar issue in safe_device and found this thread.

fahmisatrio commented 1 year ago

is there any update on this issue? still got wrong isMockLocation = true on many users eventhough they did not use any mock gps apps

AlexSeednov commented 1 year ago

Hey! Got the same problem, so migrated on fake_gps_detector package and it works fine. But original package is not null-safety, so it's necessary to use this PR - https://github.com/andiksetyawan/fake_gps_detector/pull/2

wahyu-handayani commented 1 year ago

Hey! Got the same problem, so migrated on fake_gps_detector package and it works fine. But original package is not null-safety, so it's necessary to use this PR - andiksetyawan/fake_gps_detector#2

Hi I am trying fake_gps_detector package (I just add fake_gps_detector: ^0.5.0 in my yaml and call the function in my project) but I don't get the result of await FakeGpsDetector.isFakeGps for more than 5 seconds, is it really take a long time to get the result of await FakeGpsDetector.isFakeGps. ?

AlexSeednov commented 1 year ago

Hi I am trying fake_gps_detector package (I just add fake_gps_detector: ^0.5.0 in my yaml and call the function in my project) but I don't get the result of await FakeGpsDetector.isFakeGps for more than 5 seconds, is it really take a long time to get the result of await FakeGpsDetector.isFakeGps. ?

Hi! I had an error (not an exception, just an error in console log) when I tried await FakeGpsDetector.isFakeGps at first time (wrote about it here - https://github.com/andiksetyawan/fake_gps_detector/pull/2#issuecomment-1544674034). After fixing this error, it becomes to work fine and fast (less than 1 sec). Checked on android emulator and on my device

wahyu-handayani commented 1 year ago

Hi I am trying fake_gps_detector package (I just add fake_gps_detector: ^0.5.0 in my yaml and call the function in my project) but I don't get the result of await FakeGpsDetector.isFakeGps for more than 5 seconds, is it really take a long time to get the result of await FakeGpsDetector.isFakeGps. ?

Hi! I had an error (not an exception, just an error in console log) when I tried await FakeGpsDetector.isFakeGps at first time (wrote about it here - andiksetyawan/fake_gps_detector#2 (comment)). After fixing this error, it becomes to work fine and fast (less than 1 sec). Checked on android emulator and on my device

I will try to add that configuration and I wanna ask about how you add fake_gps_detector package in yaml, do you add like this : fake_gps_detector: ^0.5.0 or you add github link of fake_gps_detector in yaml ?

AlexSeednov commented 1 year ago

I will try to add that configuration and I wanna ask about how you add fake_gps_detector package in yaml, do you add like this : fake_gps_detector: ^0.5.0 or you add github link of fake_gps_detector in yaml ?

For using non-published fixed version you can just add next lines in pubspec instead of fake_gps_detector: ^0.5.0

  fake_gps_detector:
    git:
      url: https://github.com/4RSIM3R/fake_gps_detector
wahyu-handayani commented 1 year ago

I will try to add that configuration and I wanna ask about how you add fake_gps_detector package in yaml, do you add like this : fake_gps_detector: ^0.5.0 or you add github link of fake_gps_detector in yaml ?

For using non-published fixed version you can just add next lines in pubspec instead of fake_gps_detector: ^0.5.0

  fake_gps_detector:
    git:
      url: https://github.com/4RSIM3R/fake_gps_detector

Thank you veeeeery much, I will try your suggestion

ZaenalMuzaqqi commented 1 year ago

i have the same problem but I resolved it by writing twice

isFakeGPS = await maps.detectFakeGPS(); isFakeGPS = await maps.detectFakeGPS();

I think it would be better if it was written once