Questions tagged [mock-location]

26 questions
3
votes
2 answers

is there any way to read "select mock location app" from Android developer settings?

I know the recomended way to know in Android if a location is a fake point is something like this: boolean isMock = false; if (android.os.Build.VERSION.SDK_INT >= 18) { isMock = location.isFromMockProvider(); } else { // Old Android versions…
Goin
  • 3,856
  • 26
  • 44
3
votes
3 answers

How to detect mock location in flutter for ios and android

I am using package of location and google maps flutter in my screen and I want to detect wether user using fake gps or not.. Is there a package that can detect mock location in flutter that available in android and ios? I have tried using TrustFall…
wahyu
  • 1,679
  • 5
  • 35
  • 73
3
votes
1 answer

Mocking location on Android 8.0 (Oreo)

I have an application (call it A) that runs a service that mocks the location obtained from a bluetooth GPS in order to use it in another application (call it B): A (with service that gets bluetooth GPS location) Mock location in android system B…
Knorf
  • 101
  • 1
  • 11
2
votes
1 answer

Detect mock location in flutter

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…
wahyu
  • 1,679
  • 5
  • 35
  • 73
2
votes
0 answers

How to mock location on Android?

I use the code below to set a mock location without requiring the Location permission. However, the code is inconsistent on Android devices with the latest Google Play Services version which utilizes the FusedLocationProviderClient. Sometimes it…
user13273341
1
vote
2 answers

isFromMockProvider() is returning true even if I am turning off fake/mock location

I am getting location, to check that is it Mock or not I am doing it as: if(location.isFromMockProvider()){ return true; } If there is no fake gps app, it will return false. I am testing it by downloading fake gps apps and adding them to…
1
vote
1 answer

Best way of setting mocklocaiton on Android

Apparently there are 2 ways of setting mock location in the Android ( currently playing with Android 11 ) One way using FusedLocationProviderClient: mFusedLocationClient =…
xchg.ca
  • 1,154
  • 2
  • 15
  • 28
1
vote
1 answer

appium settings app preventing my application to run

Please find below attachmentmainerror Error: "you have an unauthorized fake location app in your mobile phone uninstall appium settings to continue appium error" I have uninstalled the app, but when I run my code again appium settings app is…
iammallikarjuna
  • 171
  • 1
  • 6
1
vote
3 answers

How to prevent Android Mock Location in PWA application?

In PWA, we can get device's current position with W3C geolocation API. It is easy. if (!navigator.geolocation) { status.textContent = 'Geolocation is not supported by your browser'; } else { status.textContent = 'Locating…'; …
kochizufan
  • 2,120
  • 2
  • 30
  • 50
1
vote
0 answers

Way to use FakeGPS with FusedLocationProviderClient

I working on taxi application and i need testing location updates. FakeGPS (or same small apps) provide it. I implemented GpsTracker and its working as well, but mock location dont call locationcallback. client.setMockMode(true) dont helps me. Can…
1
vote
1 answer

How can I make the mock location provider to work

I have a need to create a test application which can mock the location. On clicking button, the latitude and longitude values provided in text box need to be set as the mock location. I am trying to build this using simple way using fused location…
Roy
  • 43
  • 4
0
votes
1 answer

Using a mock location provider in an espresso test on Android 11+

My Android app uses the position provided by the gps. One of my classes overrides the onProviderDisabled method of LocationListener. The app is working fine and gets the gps position. I have an Espresso test that create a test provider for mock…
Laurent D.
  • 449
  • 4
  • 19
0
votes
0 answers

Do not show system toast about mock location while testing with espresso

I am testing my Android app with Espresso and I am using mock locations. The mocking part is working fine. Up to now, I was testing on an Android 8 device. I now have an Android 12 device, and when launching my activity, a system toast warning me…
Laurent D.
  • 449
  • 4
  • 19
0
votes
0 answers

Detect mock location accurately in flutter

I am using trust_location: ^2.0.10 package to detect mock location or fake gps. It works fine when I try it in my own phone but when some others try it in their phone they get the status of trust_location is true and then false while the mock…
wahyu
  • 1,679
  • 5
  • 35
  • 73
0
votes
3 answers

Error Boolean isFromMockProvider() on a null object reference

can you help me. i have an error in my code with a boolean isFromMockProvider() on a null object reference. this problem occurs when the gps on my provider is slow can you guys help me with dealing with the error here is my code: GetLocation…
1
2