3 Replies - 876 Views - Last Post: 27 January 2013 - 05:46 PM

#1 jomo8459   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-January 13

Google map api does not work

Posted 27 January 2013 - 08:26 AM

Hi,

I am new to android an I am trying to get google maps working within my application. The code compiles without errors, but the map does not show up when staring the program. The relevant code looks as follows:
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);
}
}



Manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="INSERTEDMYAPIKEYHERE"/>

<permission android:name="com.example.radiationmap.permission. MAPS_RECEIVE" androidrotectionLevel="signature"></permission>
<uses-permission android:name="com.example.radiationmap.permission. MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.per mission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_ST ORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOC ATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCAT ION"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.radiationmap.RadiationMa p"
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.SupportMapFragm ent"/>

</RelativeLayout>


Can anybody please tell me what I am doing wrong / what I am missing?

thanks,

Jomo

This post has been edited by macosxnerd101: 27 January 2013 - 10:21 AM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Google map api does not work

#2 farrell2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 874
  • View blog
  • Posts: 2,706
  • Joined: 29-July 11

Re: Google map api does not work

Posted 27 January 2013 - 08:40 AM

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="INSERTEDAPIKEYHERE"/>

You need to have your debug key set up properly. It won't work without it. Reference the tutorial and register for your API key. It is the hardest part. :)
Was This Post Helpful? 0
  • +
  • -

#3 jomo8459   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-January 13

Re: Google map api does not work

Posted 27 January 2013 - 08:50 AM

Hi farrell,

I already have created a key using debug.keystore and inserted it in the meta data. I did not want to post my key here because I was not sure if it is allowed. So, to be more specific my code looks like this:

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA21WW8XXXXXXXSIUAO6ZKBxnQ"/>

Am I using this correctly? How can I find out whether the key that I have created is accepted at all?

thanks
Was This Post Helpful? 0
  • +
  • -

#4 farrell2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 874
  • View blog
  • Posts: 2,706
  • Joined: 29-July 11

Re: Google map api does not work

Posted 27 January 2013 - 05:46 PM

Then I have no idea. Are you sure your key is correct?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1