Currently I am working on Google Maps and for creating that I followed all instructions in the android developers site. But I cant load map in my device, but I can point various places and all. Will my device support Google API V2? Is there any way to view map on my device? My device version is 2.3.3.
Asked
Active
Viewed 1,224 times
0
-
r u testing ur application in different devices? – TheFlash Jul 23 '13 at 07:29
-
1Can you paste your logcat here. – RAAAAM Jul 23 '13 at 07:29
-
07-23 13:01:18.726: E/MapActivity(2640): Couldn't get connection factory client...... I can view grid and also all the points but the map is not loading – svs Jul 23 '13 at 07:31
-
Can I test map application in my device? Will it load the map? – svs Jul 23 '13 at 07:43
-
this can be your answer of your question: http://stackoverflow.com/a/15658739/1081355 – Armaan Stranger Jul 23 '13 at 08:19
-
I have added that code but still the same problem. :( – svs Jul 24 '13 at 04:53
1 Answers
1
I have a working GoogleMaps v2 application and initially I had the same issues that you describe. The problem in my case was that the API key I used was not matching the certificate I used to sign the application (debug/dev for the development phase and release for the Play released app). The application is working on all Android versions from 10 and on (so it works on 2.3.3). From the log error it sssems you may be having a connectivity issue. Did you declare the appropriate uses permissions? It 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 is a short snippet of the 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 the layout to the activity
} else {
setContentView(R.layout.location_activity); // bind the layout to the activity
}
// Configure the Map
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setSatellite(false);
mapController = mapView.getController();
mapController.setZoom(15); // Zoon 1 is world view
myLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
// More map configurations follow...
And the layouts (notice the difference in the 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" />

Miron Ophir
- 99
- 6
-
How to get that v1 api key? I don't have it with me,only have that v2 api key. – svs Jul 24 '13 at 04:58
-
Are you using "google_maps_v1_api_key" in your project? Is there any way to check app using v2 api key on device having lower versions? – svs Jul 24 '13 at 05:20