• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps google maps app api key?

thesvls

Lurker
Im developing an android app which i want to show a map.
however i can't get it to work propperly, the search through different forums didn't seem to help and got me even more errors.

the app won't start, after starting it up it shuts down with the message that it has stopped working

see next post for my current code, don't know where i went wrong.
 
main.xml
HTML:
<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="ABQIAAAAVcJQrx7VsumiP2heFwp6URQLaiSrhXTkLq3mA9rOmHpVsHwBjxTg7C5-XXHl634dCROpHwKMO9BzmQ"
/>

Main.java
HTML:
package com.example.mapme;

import android.os.Bundle;
import com.google.android.maps.MapActivity;
 
public class Main 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()
    {
        return false;
    }
}

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

    <application android:label="MapMe" android:icon="@drawable/ic_launcher">
        <activity android:name="MapMe"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.maps" />
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

ps: the api key is an random key from google, can't get an api v2 key. (fixed)
 
Your using the api v1 code.

main.xml should be like this
Code:
<fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>
and the api key number goes in the manifest now, not the layout.

Also supportMapFragment in the java.
 
Back
Top Bottom