Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spoof or fake location on Android phone

I've been trying to get this to work for a few days without success. Basically, I'm writing a small test app to make the phone report it's position as somewhere else using addTestProvider and setTestProviderLocation etc. Basically it looks fine and appears to report its location as having changed, however Google Maps etc. seems to still be querying the real GPS provider. Does anyone have any ideas how to get around this?

This isn't an app that will actually be used for anything, it's just really to satisfy my own curiosity and gain an understanding.

Thanks in advance.

like image 391
m0thman Avatar asked Jul 29 '10 13:07

m0thman


1 Answers

You need to first allow your application to use Mock locations by adding the following to the manifest xml:

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

On your phone, ensure 'Mock Locations' are enabled by selecting the “Allow mock locations” option under the Settings -> Applications -> Development menu.

And then use a mock location provider to give fake locations (e.g. by reading data off a file/db)

Alternatively you can telnet into your phone and mock the location (again you need permission and mock locations enabled on your phone):

$ telnet localhost 5554
Android Console: type 'help' for a list of commands
OK
geo fix -82.411629 28.054553
OK
like image 125
Thira Avatar answered Oct 04 '22 01:10

Thira