I have a GPS navigation application for Android 2.3.3 which I have been working on. I am currently trying to simulate locations via a GPX file through DDMS. While this works perfectly find on the android emulator, I am unable to get it working on an actual device.
I am able to see the device on the under the "Devices" tab, but I am unable to send any mock location data, or GPX data as the options are under "Emulation Control" tab are grayed out.
I have noticed that previous questions on StackOverflow mention that it is not possible, however the Google docs titled "Using DDMS" - http://developer.android.com/tools/debugging/ddms.html state the following (at the bottom of the page)
Setting the location of the phone
If your application depends on the location of the phone, you can have DDMS send your device or AVD a mock location. This is useful if you want to test different aspects of your application's location specific features without physically moving. The following geolocation data types are available to you:
I am just wondering how to send fake location data to a device via DDMS. Thank you for your help in advance, and I really appreciate it.
Bilzac, your understanding is correct. Simply put, Android's documentation is misleading. Many developers have been confused by this. You cannot load a gpx file and send to device like you do on the emulator contrary to what the documentation suggests.
Possible if you activate mock locations on your device. Than add ACCESS_MOCK_LOCATION permission to your manifest.
You can write now your own MockLocationManager which generates mocj locations.
Easiest way is to you use an app which generates mock lactions for you. GPS Route Simulator works quite fine. Possible to store kml files on the sdCard or defines own routes
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