I am using Android 5.1.1 on lenovo p70-A.
I was using https://play.google.com/store/apps/details?id=com.incorporateapps.fakegps.fre to mock my location with GPS in device only mode. The problem is there that now I can't obtain my real location in device only mode no matter if mock location is enabled or disabled. Any ideas how can I fix it?
P.s I have enabled xposed module called "mock mock location" which tell selected apps that mock location is off. I have set it for only one app.
you can open settings in the search bar write "fused location" clear the data and force stop and congratulations :) you don't have to restart the phone .
Related
I added a test provider using LocationManager.GPS_PROVIDER as provider name like described here
https://mobiarch.wordpress.com/2012/07/17/testing-with-mock-location-data-in-android/
In Google Maps app, I see location jumping between mocked location and real location, and then back to mocked location.
Why is jumping to real location and how can I stop it?
Maybe I misunderstand how to use mock locations. I haven't found any official documentation available.
You most likely have your location settings configured in a way that your phone (and apps) can use both the location from the GPS sensor and the location from the cells and wi-fi. Since the coming of the Fused Location Provider, the way the system fetches your location got a bit murkier.
When you mock the position you are only able to mock the GPS sensor readings (this is also true for when you mock the position through the simulator settings).
So when the system feeds Google Maps with a position from the GPS sensor it gives it the fake one, and when it provides the position from other sensors it will be the real one.
To test that I'm correct, you can switch location settings to "Device only" and you should only get the fake positions.
Unfortunately there's no way to mock the other sensors readings.
Turn off Wi-Fi scanning / Bluetooth scanning in the Location Settings to stop jumping to preserve mock location.
I am using the location service (GoogleApiClient) in my application and I have to check the received location is mock or not. I am using the location.isFromMockProvider() for checking, and it was working fine for higher version of devices with all fake gps applications.
Here I am adding the scenarios that will fail.
Take Samsung S7 (I got from S7) or any other high end device.
Install "Fake GPS Go" application and set a fake location
Check the received location (location.isFromMockProvider() returns false)
Thanks in advance.
I've been trying to get mock locations on my OnePlus One working for quite some time now, but I have unfortunately been unable to determine the cause of this. Essentially my issue is that when setting a mock location, they do work, but for some reason my location appears to "teleport" between where I set my mock location and my current location. I've been using Google Maps to test my current location. Following the guidance of this answer, I set my location mode to "Device only", but it appears to still be happening. Furthermore, I turned off WiFi completely, to no avail.
The app I am using to spoof my location is here. I've tried other apps to the same effect. My phone is running the latest CyanogenMod 13 snapshot (20160419).
If anyone would happen to know how to solve this, it would be much appreciated :)
The steps given below worked for my Nexus 6:
(I have assumed that your device is rooted. If not you need to root it first)
Install Xposed framework. You can use the tutorial here.
After Xposed is installed go to its Download section and install the module Mock Mock Locations. Then go to the Modules section in the Xposed app and activate the downloaded plugin(needs restart).
In developer options select the mock location app you are using in Debugging->Select mock location app
Download the app Disable Service. In the app select the System tab search for the service named Fused Location and disable it. Also search for the service group Google Play Services. Inside it there will be another
Fused Location service. You need to disable it too.
If it is still not working try disabling Google Location History as given here. Also set your GPS accuracy to Device Only.
Install Fake GPS Location app in your Android device and set your desired location inside the app. Your device will behave as if it is at the location you have set. Don't forget to select Select mock location app in Developer options in your device Settings.
In case someone has issues with mock location software to get working:
override fun onLocationResult(locationResult: LocationResult) {
var LastLocation: Location = currentLocation
if (LastLocation.longitude > X.XXX && LastLocation.longitude < X.XXX && LastLocation.latitude > X.XXX && LastLocation.latitude < X.XXX) {
LastLocation.latitude += Y.YYY; LastLocation.longitude += Y.YYY
}
X.XXX is a placeholder. Set a bounding box for your ow current location to shift your location to the new destination by changing Y.YYY
With something like this, you could shift your location and simulate hardcoded from your home/office location your desired location.
1) Is it possible to get the original present location coordinates from ANDROID LOCATION SERVICES after mocking GPS location, with mock mode ON ?
This location should be got without making the mock mode OFF.
Else,
2) I need to disable the location services GPS for a while, turning on and off mock location.
Sure you can, from Google doc http://developer.android.com/training/location/location-testing.html
To turn off mock mode while the location client is connected, call
LocationClient.setMockMode(false).
I have written a small app that receives the location from mobile 3g/wifi by using locationManager & NETWORK_PROVIDER parameter.
according to google's api it will get the location i wish (the other option is using the GPS_PROVIDER)
what i really desired was the WIFI location. I wanted to see its behavior and how the phone gets its location (i.e with wireshark)
in order to do that, i changed into flight mode & activated wifi.
then, i launched the app and clicked the button which starts the NETWORK_PROVIDER location service by calling the requestLocationUpdates function with time parameter = 10.
what that actually happened is that i managed to get the location but saw no traffic at all in wireshark.
could it be that Google gives me the approx. location in advance, when connecting to the wifi? (its the only explenation)
If so, is it possible to clear that cache, or whatever data it have stored, and force the phone to get a new (but the same) location?
Thanks in advance,
Eran.
Have you tried re-booting the phone, just so to remove any cache files which might be storing the location?
Since NETWORK_PROVIDER use cell location, wifi ssid and their signal strength to get your GPS coordinates.
Since you are in flight mode and cannot get cell location, just try to switch the connected wifi , maybe google service will be invoked to get new location.