android - Google maps API v2 not working on device -
currently working on google maps , creating followed instructions in android developers site. cant load map in device, can point various places , all. device support google api v2? there way view map on device? device version 2.3.3.
i have working googlemaps v2 application , had same issues describe. problem in case api key used not matching certificate used sign application (debug/dev development phase , release play released app). application working on android versions 10 , on (so works on 2.3.3). log error sssems may having connectivity issue. did declare appropriate uses permissions? should be:
<uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location"/>
here short snippet of main map code:
public class locationactivity extends mapactivity { private mapcontroller mapcontroller; private mapview mapview; private locationmanager locationmanager; private mylocationoverlay mylocationoverlay; public void oncreate(bundle bundle) { super.oncreate(bundle); if(utils.isrelease(getapplicationcontext())) { setcontentview(r.layout.location_activity_release); // bind layout activity } else { setcontentview(r.layout.location_activity); // bind layout activity } // configure map mapview = (mapview) findviewbyid(r.id.mapview); mapview.setbuiltinzoomcontrols(true); mapview.setsatellite(false); mapcontroller = mapview.getcontroller(); mapcontroller.setzoom(15); // zoon 1 world view mylocationoverlay = new mylocationoverlay(this, mapview); mapview.getoverlays().add(mylocationoverlay); // more map configurations follow...
and layouts (notice difference in maps api key): location_activity.xml
<?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:apikey="@string/google_maps_v1_api_key" android:clickable="true" />
and (location_activity_release.xml):
<?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:apikey="@string/google_maps_v1_api_key_release" android:clickable="true" />
Comments
Post a Comment