android - Google Map API version 2 Failed to contact Google servers -
android - Google Map API version 2 Failed to contact Google servers -
i have started create demo app uses google map api v2, followed google guide http://developer.android.com/google/play-services/maps.html & http://www.truiton.com/2013/05/android-mapfragment-example/.
the map activity loading, actual google map not loading, error message:
06-18 10:19:23.717: i/google maps android api(29990): failed contact google servers. effort made when connectivity established.
06-18 10:19:38.903: e/google maps android api(29990): failed load map. error contacting google servers. authentication issue (but due network errors).
could error caused due fact i'm on 3g/edge slower than 4g or wifi, in turn might causing connection timeout???
below activity:
package com.example.theappdallas; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.annotation.suppresslint; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.os.build; public class mapviewactivity extends fragmentactivity { private googlemap map = null; @suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_map_view); map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map1)).getmap(); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.map_view, menu); homecoming true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { homecoming true; } homecoming super.onoptionsitemselected(item); } }//end class
below layout:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <fragment android:id="@+id/map1" android:layout_width="match_parent" android:layout_height="400dp" class="com.google.android.gms.maps.mapfragment" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:src="@drawable/map_view_directions" /> <imageview android:id="@+id/imageview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:src="@drawable/map_view_pin" /> <imageview android:id="@+id/imageview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:src="@drawable/map_view_search" /> </linearlayout> </linearlayout>
below manifest(i have set permissions & provided new api key):
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.theappdallas" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <!-- permissions --> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state"/> <permission android:name="com.example.permission.maps_receive" android:protectionlevel="signature"/> <uses-permission android:name="android.permission.read_gservices" /> <uses-permission android:name="android.permission.access_wifi_state" /> <!-- splashscreen --> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <meta-data android:name="com.google.android.gms.version" android:value="4452000" /> <activity android:name="com.example.theappdallas.splashscreen" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <!-- api key --> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="*************************" /> <!-- mainmenuactivity --> <activity android:name="com.example.theappdallas.mainmenuactivity" android:label="@string/title_activity_main_menu" android:screenorientation="portrait" > </activity> <!-- mapviewactivity --> <activity android:name="com.example.theappdallas.mapviewactivity" android:label="@string/title_activity_map_view" > </activity> </application> </manifest>
screenshot of mapviewactivity:
thanks
i uncertainty map not showing due connection timeout; problem api key. i follow these instructions closely create sure generating api key correctly. allow me know if have specific questions regarding process. also, should remove api key code post.
android google-maps google-maps-api-3
Comments
Post a Comment