Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't get connection factory client - fighting with Google Maps

another day another problem, I finally managed to set up correctly google maps on my android application, or at least I thought I've done it, the whole progam starts, it even call the class which should "print" a map, but the only thing I can see is a grid with google label on it [ in the corner ]. I've checked the dalvik monitor and the error

E/MapActivity(394): Couldn't get connection factory client

occurs. I've find out on stackoverflow website that I should sent a gps signal or sth like this from dalvik monitor, and I've done it. Nothing happend, also I got the api key one more time, but nothing changed.

here is map.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This file is /res/layout/mapview.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" 
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/zoomin" 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:onClick="myClickHandler"
android:padding="12px" />
<Button android:id="@+id/zoomout" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="-"
android:onClick="myClickHandler" 
android:padding="12px" />
<Button android:id="@+id/sat" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Satellite"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/street" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Street"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/traffic" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Traffic"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/normal" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Normal"
android:onClick="myClickHandler" 
android:padding="8px" />
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/mapview" 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:clickable="true"
android:apiKey="0zPcz1VYRSpLusufJ2JoL0ffl2uxDMovgpW319w" />
</LinearLayout>

here is a MapMapa.java

public class MapMapa extends MapActivity
{
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
mapView = (MapView)findViewById(R.id.mapview);
}

public void myClickHandler(View target) {
switch(target.getId()) {
case R.id.zoomin:
mapView.getController().zoomIn();
break;
case R.id.zoomout:
mapView.getController().zoomOut();
break;
case R.id.sat:
mapView.setSatellite(true);
break;
case R.id.street:
mapView.setStreetView(true);
break;
case R.id.traffic:
mapView.setTraffic(true);
break;
case R.id.normal:
mapView.setSatellite(false);
mapView.setStreetView(false);
mapView.setTraffic(false);
break;
}
}
@Override
protected boolean isLocationDisplayed() {
return false;
}
@Override
protected boolean isRouteDisplayed() {
return false;
}

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="menu.dot" android:versionCode="1" ndroid:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<uses-library android:name="com.google.android.maps" />
<activity android:name="MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity android:name=".About">
android:label="@string/about_title" 
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity android:name=".Exit">
andorid:label="@string/exit_title"> 
</activity>
<activity android:name=".Options">
</activity>
<activity android:name=".Start">
</activity>
<activity android:name=".Create">
</activity>
<activity android:name=".Where">
</activity>
<activity android:name=".Proceed">
</activity>
<activity android:name=".Finish">
</activity>
<activity android:name=".Login">
</activity>
<activity android:name=".OK">
</activity>
<activity android:name=".UserPanel">
</activity>
<activity android:name=".Managero">
</activity>
<activity android:name=".Edition">
</activity>
<activity android:name=".Done">
</activity>
<activity android:name=".Delete">
</activity>
<activity android:name=".MapMapa">
</activity>

</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-sdk android:minSdkVersion="3" />
</manifest> 

my view

like image 347
iie Avatar asked Nov 02 '11 14:11

iie


People also ask

Why does Google Maps keep saying can't connect?

There are various reasons why this happens. It's possible the location accuracy option is disabled, you're using an older version of the app, or you don't have proper access to the internet. The Google Maps app itself may have issues, too. Cache files and other app data can sometimes cause various issues with the app.

How do I fix Google Maps not working?

Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.

What is wrong with Google Maps lately?

More and more Android users ended up struggling with all kinds of problems in Google Maps, including broken navigation, GPS connection issues, audible guidance not working, and freezes occurring all of a sudden when the app is minimized.

How do I reset my Google Maps?

Procedure for Android 4.1.Go into the applications manager. Press on the options button (bottom left of screen) to display a menu. Press on Reset preferences.


1 Answers

E/MapActivity(394): Couldn't get connection factory client 

This will not be issue in your case. It's just warning message.

For using Map,things you need to Keep in mind :

1.Add internet permission in Manifest file

    <uses-permission android:name="android.permission.INTERNET" />

2.Add Library code in Manifest file :

 <uses-library android:name="com.google.android.maps" /> 
  1. Extend Map Activity instead of Activity also ensure that your SDK is Google not Android

  2. Then generate Map Key using Release Key and not by using Default Android Debug key Check this post for creating Key using Release Key.

For further references check this link Mobi Forge

Output of your code

like image 94
Venky Avatar answered Nov 11 '22 16:11

Venky