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.
Related
I am working on a GPS device (not a phone, no screen ...) with a custom rom. My app is a system app.
NETWORK_PROVIDER is not available, only FUSED_PROVIDER and GPS_PROVIDER are enable. I check with this code :
locationManager.getProvider(LocationManager.FUSED_PROVIDER) != null,
locationManager.getProvider(LocationManager.NETWORK_PROVIDER) != null
locationManager.getProvider(LocationManager.GPS_PROVIDER) != null
getAllProviders() return [passive, gps]
If I use LocationManager.GPS_PROVIDER I get the locationbut only outside.
If I use LocationManager.FUSED_PROVIDER I get nothing ...
Off course if I use LocationManager.NETWORK_PROVIDER I get nothing
I have tried with Wifi enable and disable, same result.
I am listening the location like this :
Settings.Secure.putInt(caniGPSApplication.getApplicationContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
locationManager.requestLocationUpdates(LocationManager.FUSED_PROVIDER, GPSTimerMS, 0, this);
I think FUSED_PROVIDER is not working because NETWORK_PROVIDER is not available but I do not really know.
I wish to have NETWORK_PROVIDER because it will help to have a location when GPS is not available. Do you know why NETWORK_PROVIDER is not available ? What should I do to enable it ?
Thank you :)
I have solved the problem.
I have added 3 packages in priv-app :
NetworkLocation.apk (middleware) from https://github.com/microg/UnifiedNlp#usage
org.openbmap_27.apk (provider) from https://github.com/openbmap/radiocells-nlp-android
IchnaeaNlpBackend.apk (provider) from https://github.com/microg/IchnaeaNlpBackend
NetworkLocation.apk is a apps which replace the Google Network provider, this one is only a middleware and need providers to get data (cells database ...).
Off course i am working on a custom rom, I can install apk in priv-app, consequently I have all specifics right necessary to do it.
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 .
I have installed genymotion along with the google play services. I have installed Google Maps using the apps store and i would like it to update my location to either my current location or a fake location i provided. The reason is that i am trying to test an app that uses the google maps api.
Device i created is a Galaxy S6 -6.0.0 - API level 23
Settings > Personal > Location > High Accuracy is on
GPS for the emulator is ON and the location is set. When i go back to my app however, it is not updating the location on the map.
Is there a way to inject the location with geny shell or?
EDIT : I can also access my maps app from the browser but I get the following:
1) website wants to know your location? I press share location
2) This site cannot access your location. Change this on the Settings > Advanced > Website screen
There is nothing to do here except clear location preferences for individual sites.
Any help or advice is appreciated.
For anyone retrieving getLastKnownLocation on Genymotion in order to set a point on the map or something of the sort like this:
LocationManager locationManager = (LocationManager)getActivity().getSystemService(
AppCompatActivity.LOCATION_SERVICE);
// First try and get last location from network provider
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
// If that doesn't work, try the GPS provider
if(location == null) {
location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}
Setting the device lat/lng through the GPS widget or the Genymotion shell does not automatically update your lastKnownLocation the device. I had to manually open Maps, let it update to the specified position in order to set lastKnowLocation, and it worked from there.
I'm using new Location API (FusedLocationProviderApi) and get confuse about it.
I intend to use LocationRequest.PRIORITY_HIGH_ACCURACY. But, on device, if user choose the location mode is save battery (network only). -> What is the bahevior for my app?
Does it update with hight accuracy (with internet, gps..) OR
Does it will be limited follow the setting of user?
Please correct me if i missunderstand anything.
So I know next to nothing about GPS and Apps, but I do want to get my feet wet and have a (simple-ish in my mind) idea for a simple app based on GPS or manual address.
I basically need to know if you can do something like this
if GPS Location is (11.111/22.222) { Show(**THIS STUFF**) }
or if manual address is (555 Main St, Salem, OR) { Show(**THIS STUFF**)}
in android or iphone
You can. It's considerably more complex than that. And there are apps for both platforms that do exactly that. A quick search of Google, Apple Store, and Android Market will tell you what the current apps for that are.
If you want to do this yourself you will need to learn some new concepts. Geofencing (geographic buffers). Geolocation (address to coordinate conversion). And read up on how to efficiently use the location services provided by the devices you are writing for.
You should use android location api for GPS Location, and check in the onLocationChanged() method : if(myLocation.getLatitude==11.111 && mylocation.getLongitude==22.222)
On manual adress You should use android maps api.