0

I've got an application in the browser that's customized to use Android's browser geolocation APIs. I'd like to find a way to fake the lat/lng that's sent to the browser so I can type in arbitrary coordinates.

In doing some research I came across DDMS - http://developer.android.com/guide/developing/tools/ddms.html - which seems to do what I want, but seems to require the IDE or an emulator. I don't want to use an emulator because I want to test on the device and I don't have the IDE set up for Android.

Does anyone know if there's a way to send mock location data to an Android device without loading up the IDE (or doing it through the emulator)?

ryanstewart
  • 1,004
  • 10
  • 18
  • If you don't want to test on an emulator or IDE, what are you looking to test this on? a physical device with a GPS receiver? without a receiver? or a browser on a non-android device (laptop, pc, etc)? – Adam Apr 27 '10 at 23:26
  • I'm hoping to test it right on the device. I want to be able to plug in any lat/long and be able to test my application on the device with those geocoordinates. – ryanstewart Apr 28 '10 at 06:51

2 Answers2

1

I do not believe this is possible -- sorry!

Also the DDMS and IDE solutions are one and the same and only work with the emulator.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Cool, I'll do a bit more research and if it doesn't work I'll consider this answered. Thanks! – ryanstewart Apr 28 '10 at 06:51
  • @ryanstewart @Firelord I'm trying these commands, but they don't affect Tinder on Androd for example: `~/Android/Sdk/platform-tools$ ./adb -s 2C051FDH3002LA shell appops set com.google.android.gms android:mock_location allow ~/Android/Sdk/platform-tools$ ./adb -s 2C051FDH3002LA shell am broadcast -a android.intent.action.GEO_LOCATION --es "lat" "38.6979" --es "long" "-9.2064" --ei "error" "10" Broadcasting: Intent { act=android.intent.action.GEO_LOCATION flg=0x400000 (has extras) } Broadcast completed: result=0` – Elad Benda Aug 06 '23 at 13:53
0

Just in case someone stumbles across this question like I did, here is some info about how to mock the LocationProvider on a physical device. Marking this as community wiki because I didn't come up with the original answer. Code is listed in diffract.me/2009/11/android-location-provider-mock (looks like domain is expired as of 9/29/2010, I used Google's cache of the page) & from stackoverflow.com/.../android-mock-location-on-device.

Community
  • 1
  • 1
Marc Bernstein
  • 11,423
  • 5
  • 34
  • 32