Since i am going through chapter 9 of “Android: A Programmer’s Guide” (ISBN:978-0-07-159988-7) and i can’t get the example app working, I put that aside today to work on other examples of Location Based applications. The first is here:
I used the emulator to run this app and I get the output similar to what is shown. However, i haven’t figure out how to work with kml file. I meddled with the DDMS and loaded the kml manually but i cannot see the effect of that. I notice there was a GPS icon on my emulator the last i run it a few hours ago and now I don’t see it any more. Could be the changes on emulator’s settings that i did but I’m really not sure right now. I have to review this example.
I am now trying out this example app:
Created the project, generated the Google Maps API key (the debug.keystore is in C:Documents and Settings<username>.android) and successfully displayed the map. There’s a bit fixing before i am able to display the map though. Firstly, Eclipse complaint that it has problem resolving com.google.android.maps.MapActivity. Turns out that I was using Android 1.5 and the application requires Android 1.5 + Google API. I have to install it (Windows ->Android SDK and AVD manager). Then I go my projects properties dialog as shown below (right click on project name and select properties). I checked the new target that i have just installed, click apply followed by okay button and the problem is solved!!
The second problem is the Android Virtual Device(AVD) the app requires is not compatible with the current one. So I have to create a new AVD. This is the command to create it:
android create avd -n my_android1.5 -t 3
-n is the name of the new AVD while -t argument is the target ID (which can be found by running the command “android list targets“). The final thing i did is check that i have type the code as instructed and this is what i achieved.
I’m still far away from completing this example but it is already 1.30 am and i need my rest.
Regarding the chapter 9 example, I haven’t figure out how to create a mock gps running for the emulator as required by the example. I am stuck with this example as well as it uses a LocationManager method, getCurrentLocation(), that is no longer available. In the forum, someone suggested getLastKnownLocation(). When i try this out, my application crashed when i press the “Where Am I” button.