Fixing Geolocation for Android Emulator in Appcelerator Titanium
I've been playing around with Appcelerator Titanium lately and one thing that I found frustrating was the fact that I couldn't get a GPS fix with the Android emulator. The iPhone emulator on the other hand was returning my current position just fine.
Of course, dummy data is being returned by the emulator. To make sure that the Android emulator returns a valid GPS location by using Geolocation in Titanium, you need to do the following:
1 - launch the Dalvik Debug Monitor a.k.a. ddms
The location of this tool depends on where you installed the Android SDK. For me, ddms is installed in /Users/jorre/Documents/SDKs/android-sdk-macosx/tools/ddms. Start the tool.
2 - select your Android emulator
Next, you will see a list of Android emulators that are running. For me, I was only running one instance that was called "titanium_". Click on the emulator on the left side of the ddms tool.
3 - send GPS/geolocation coordinates manually to the Android emulator
After selecting the Android emulator in the ddms tool, you will see a number of options on the right hand side of the ddms tool. The tab you are looking for is "emulator control". Scroll down until you see "Location Controls". Enter the latitude and longitude coordinates of your choice and click "Send". Voila, you should now be able to do geolocation calls on your Android emulator. Hope that helps!