Reputation: 11688
is there a way to find out if i've generated a right API key ?
from the same debug.keystore i've managed to get Facebook HASH Key with no problems but from some reason after generating the MD5 fingerprint and generated an API key from Google my map is still blank.. which mean i can only see grids in it with no map..
my internet connection is on, and i have no error in my LogCat.. is there some kind of debugging i can do in order to check whether my API key is correct or not ?
XML:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="my_generated_key"/>
UPDATE: when running a new Test application it works great with my api key. when i'm trying to embedded the map inside my application (inside a tab host) i get only grid view.
Upvotes: 0
Views: 1512
Reputation: 1160
You should add in your XML like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="api key" />
</RelativeLayout>
if you don't have a layout, you are not able to see the map.
Upvotes: 1
Reputation: 1160
If you have a gray background in your project, make sure that you have permission INTERNET in your Manifest, just before application tag. If you getting gray background on your device, make sure that you have created a new Api key with new MD5 for your application, based on your created application.keystore, which you created when you exported your app.
If you haven't done that, see this link for better explanation: One Google Maps key for all developers?
If your LogCat is fine, and you don't even have red "Couldn't get connection factory client" your map key is fine. :) But even if you had this error in LogCat, that doesn't mean anything, because it could represent some bug in Eclipse and your map will still working, no matter that, in emulator and on real device.
Upvotes: 0
Reputation: 2635
Make sure you got INTERNET permission set and that your key is really MD5. Newer version of keytool returns SHA1 key instead of MD5. To get MD5 add -v to keytool options
Upvotes: 0