Skip to content Skip to sidebar Skip to footer

Android Mapactivity Googlemaps : Couldn't Get Connection Factory Client

I'm working with googlemaps V2 and I've made my google api key V2. First time I run this program it's work and then when I run it again until this time, its always can't show the m

Solution 1:

As been already said, you are using objects from API v1 with a key from API V2. So instead of using MapView as you currently do you will have to switch to MapFragment or SupportMapFragment (for supporting older android versions). Instead on MapActivity you will have to switch to FragmentActivity (in case you use SupportMapFragment), or to a simple Activity ( in case you use MapFragment)

Of course as said the key should be move to the Manifest file, and some additional permissions should be defined there.

To get a better idea on how you should do it, you can check this blog post I wrote on integrating Google Maps API V2 in your application:

Google Maps API V2

Solution 2:

As the google Map v1 API is already depricated, So you will no longer able to use it and you have to switch on Google Map v2 and need to develop the maps according to v2 api.

In google map v2 the maps in the layout are inflated using the fragment as below:

So instead of this google map

<com.google.android.maps.MapView
    android:id="@+id/map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="AIzaSyAT5pGvWOLeEuugI8asdasE7as3osTaZjSQ"
    android:clickable="true"
    android:enabled="true" 
    />

Try as below:

<?xml version="1.0" encoding="utf-8"?><fragmentxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/map"android:layout_width="match_parent"android:layout_height="match_parent"android:name="com.google.android.gms.maps.MapFragment"/>

For more details Check out Implementation HERE

Solution 3:

Instead of defining the metadata key in the layout file, declare it in the manifest.xml as follows.

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

Post a Comment for "Android Mapactivity Googlemaps : Couldn't Get Connection Factory Client"