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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With