How to detect mock location using TrustLocation package in flutter

847 views Asked by At

I am using trust location package (https://pub.dev/packages/trust_location#-readme-tab-) to detect wether user using fake gps or not... but the problem is... when I turn on fake gps app.. trust location works fine (await TrustLocation.mockLocation=true) but when I had turned off fake gps app... I still get await TrustLocation.mockLocation=true... I need sometime to re-try my app until await TrustLocation.mockLocation=false here is part of my code

checkMock() async {
if (await TrustLocation.isMockLocation) {
  print("mock is true")
  }else{
  print("mock is false")
  }
}

I call checkMock() in an onPress of button so.. is there a way so that whenever I turn off fake gps app... TrustLocation.isMockLocation will directly get false value

0

There are 0 answers