• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Overwriting GeoLocation

Jordan B

Lurker
Hi Guys.

I know it is possible to overwrite the GeoLocation of a phone (i.e the GPS Position) in 2 ways:
  1. Enable developer mode & mock location (I've been told that some apps are aware of this and then stop the user from using that app with a fake location)
  2. Get root privileges (As far as I'm aware, this would void the warranty)
Does anyone know if it can be done without the problems above (or if these obstacles are incorrect).

I know there are reasons for the above but I'm working on a solution that will give you more precise positioning on a phone. I then want to overwrite the location source so that users can then use the new enhanced data with all of their other apps.

Any help is gratefully appreciated.

Jordan.
 
You can use the Location Services permission to mock location...

"android.permission.ACCESS_MOCK_LOCATION"

and then in your java code,

// Set location by setting the latitude, longitude and may be the altitude...
String[] MockLoc = str.split(",");
Location location = new Location(mocLocationProvider);
Double lat = Double.valueOf(MockLoc[0]);
location.setLatitude(lat);
Double longi = Double.valueOf(MockLoc[1]);
location.setLongitude(longi);
Double alti = Double.valueOf(MockLoc[2]);
location.setAltitude(alti);

Some phones have mock location debug feature. For example my Sony Xperia has it.
Also in google play do search for "Fake location" - there are many apps there.
 
Last edited:
You can use the Location Services permission to mock location...

"android.permission.ACCESS_MOCK_LOCATION"

Hey, thanks for reading and for your reply, greatly appreciated.

The mock location you've mentioned, are other apps able to detect that it's "mocked". I know if done via developer mode and allowing mock location in settings, apps like Pokemon Go can detect the setting and stop users from doing anything.

Thanks
J
 
Back
Top Bottom