Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone help me get this map app working?

The problem is that my map isn't showing. It's just the grid that shows when you (for example:) haven't got the INTERNET permission.

Here's my java class:

public class MapClass extends MapActivity {

 public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  setContentView(R.layout.maplayout);

  MapView mapView = (MapView) findViewById(R.id.mapView);
  mapView.setBuiltInZoomControls(true);
    }

 @Override
 protected boolean isRouteDisplayed() {
  // TODO Auto-generated method stub
  return false;
 }
}

Here's my XML Layout file (minus the Map Key):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/mainlayout" android:orientation="vertical"
 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:enabled="true" android:layout_height="fill_parent"
  android:clickable="true" android:apiKey="MY-API-KEY" />

</RelativeLayout>

And here's my Manifest File:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.android.mapexample" android:versionCode="1"
 android:versionName="1.0" android:installLocation="internalOnly">

 <application android:icon="@drawable/icon" android:label="@string/app_name"
  android:debuggable="true">

  <uses-library android:name="com.google.android.maps" />
  <activity android:name=".MapClass" android:label="@string/app_name"
   android:theme="@android:style/Theme.NoTitleBar">

   <intent-filter>

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

   </intent-filter>>

  </activity>
 </application>

 <uses-sdk android:minSdkVersion="1" />

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

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

</manifest>
like image 451
NotACleverMan Avatar asked Dec 07 '10 17:12

NotACleverMan


1 Answers

Make sure your app is signed with the signing key you associated with your Map API key. I suspect you are debugging, so the app is signed with the debug keystore...you have to generate a different Map API key for that.

I keep 2 layouts, one for each Map API key. I dynamically choose my layout based on whether I am running in a debug or release build.

like image 166
shammer64 Avatar answered Sep 23 '22 16:09

shammer64