views:

249

answers:

1

I am attempting to follow the Google Map View under the views tutorial for the Android. I have followed step by step but still only see grey blocks when viewed.

First: I created a Virtual Device using "Google API's(Google Inc.) Platform 2.2 API Level 8" Second: When creating my project I selected "Google API's Google Inc. Platform 2.2 API Level 8". Third: I obtained the SDK Debug Certificate Fouth: Began Coding. Main.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/mapview" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:clickable="true" 
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ" 

/>

HelloGoogleMaps.java

package com.example.googlemap;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapView;
import com.google.android.maps.MapActivity;

public class HelloGoogleMaps extends MapActivity 
{
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main);
}

@Override 
protected boolean isRouteDisplayed() { 
    return false; 
}

}

HelloGoogleMaps Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.googlemap"

  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">

<uses-library android:name="com.google.android.maps" />

    <activity android:name=".HelloGoogleMaps" android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 

 </manifest> 

Any thoughts??

Thanks!

A: 

You might try moving your permissions up earlier in your XML -- see here for a sample manifest that works on Android 2.1 and earlier (have not yet tried it on 2.2).

Also, make sure your emulator actually has Internet access. You should see a "3G" icon in the status bar with two bars of signal strength. If, instead, you have no bars and an "X" in the icon, then the emulator failed to detect an Internet connection when you started it up, and so it emulates having no connectivity.

You might also wish to try opening the regular Maps application and see if it works on your emulator. If it does not, then there may be firewall issues that are blocking your access to the map tile server.

CommonsWare
Thank you for your response, I moved the permissions as show in the exmaple as well as made sure the status bar had a connection. After restarting the emulator I received the same results, grey blocks, nothing else. Any other ideas? Thank you!
Tom
This may be a clue, in the Eclispe Debuger it sits on:[2010-05-26 12:15:07 - HelloGoogleMaps] Attempting to connect debugger to 'com.example.googlemap' on port 8699Could this be a connection issue even though the status bar say 3G and has 2 bars?
Tom
Have you tried the built-in Maps application? If there's a connection issue, it should affect it as well.
CommonsWare
Sorry for leaving that out, yes the built in maps application does work.
Tom
Then somehow your API key is messed up. It looks like a properly-structured set of gibberish, but if Maps works, then the API key is the only thing I can think of that causes your symptoms.
CommonsWare