



I was trying to get an Android app that uses Google Maps API to display a MapView running on the emulator. It took quite a bit of hair pulling to finally get it working.
First, I tried using a self-signed keystore instead of the the debug.keystore provided through the Android SDK. I created my keystore using keytool -genkey from JDK. Then I switch the app from using the default, debug.keystore, to my-new-self-signed.keystore. Using keytool -list, I got the MD5 of the certificate that is needed to obtain a Google Map API key. Then the API key was put into the MapView android:apikey attribute. When I brought up the app in the emulator, I got a blank map grid screen. The reason I wanted to use the self-signed keystore instead of the debug keystore is so I don’t have to obtain a new Map API key and change the code to reflect this upon releasing the app.
So, I decided to go with the debug.keystore and that worked fine. Here is what I had to do.
$ keytool -list -alias androiddebugkey -keystore <path_to_debug_keystore>.keystore -storepass android -keypass android
<com.google.android.maps.MapView android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="example_Maps_ApiKey_String" />
package com.informationideas.mapapp;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class ShowDesktop extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Now off to building cool things with the map!


More Options ...

Categories
Tag Cloud
Blog RSS
Comments RSS



Void (Default)
Life
Earth
Wind
Water
Fire
Lightweight