Google maps api does not work

  • 1 Antworten
  • Letztes Antwortdatum
J

jomo

Neues Mitglied
0
Hallo,

ich bin neu beim programmieren in Android und habe ein Problem mit der google maps api. Ich habe mir einen api-key besorgt und versuche nun einfach eine map anzuzeigen. dazu habe ich folgenden code geschrieben:
Code:
package com.example.radiationmap;

------ Startup activity ----
import android.os.Bundle;

import android.support.v4.app.FragmentActivity;

public class RadiationMap extends FragmentActivity {

     @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_radiation_map);
     }
}
Code:
------ Manifest
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="INSERTEDMYAPIKEYHERE"/>
    
    <permission android:name="com.example.radiationmap.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
    <uses-permission android:name="com.example.radiationmap.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.radiationmap.RadiationMap"
            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>

---- activity_radiation_map.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="INSERTEDAPIKEYHERE"/>
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />
    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>

</RelativeLayout>


Der Code kompiliert ohne Warnung und Error, aber die Karte wird nicht angezeigt. Was mache ich falsch hier?

Danke

Jo
 
Zuletzt bearbeitet von einem Moderator:
Du hast in deiner API Konsole maps v2 Android aktiviert?
Insertmapsapikeyhere hast im manifest aber schon ersetzt?
Auch mal ins log schauen

Gesendet von meinem Galaxy Nexus mit der Android-Hilfe.de App
 

Ähnliche Themen

L
Antworten
3
Aufrufe
688
mips400
mips400
4
Antworten
10
Aufrufe
1.092
jogimuc
J
Zurück
Oben Unten