我正在尝试加载谷歌地图但我不断获得"无法获得连接工厂客户端。地图加载所以我假设密钥是正确的,但这就是我所能做的。缩放控制根本不会加载,我根本无法移动地图。
package com.saff.maps;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class gpsActivityTest extends MapActivity{
private MapController mMapController;
private GeoPoint mGeoPoint;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mMapView = new MapView(this, "033wSZETHVmHYoRTPurperVQKTS8-zCsTzcbcaA");
setContentView(mMapView);
mMapView.setBuiltInZoomControls(true);
mMapController = mMapView.getController();
LocationManager mLocation= (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mLocation.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new updateHandler());
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
public class updateHandler implements LocationListener{
public void onLocationChanged(Location location) {
int lat = (int) (location.getLatitude() * 1E6);
int lng = (int) (location.getLongitude() * 1E6);
mGeoPoint = new GeoPoint(lat, lng);
mMapController.animateTo(mGeoPoint);
mMapController.setCenter(mGeoPoint);
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.saff.maps" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" android:required="true" />
<activity android:label="@string/app_name" android:name=".gpsActivityTest">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我没有把我的api代码放在xml文件中,因为我得到了#34;找不到mapViewStyle主题&#34;。我不知道问题是什么,如果我的api密钥是正确的,我肯定不会有这个问题
我已经广泛搜索了,但这并没有回答我的问题,因为我没有其他错误,除了这是我的logCat:
02-10 00:10:26.305: I/Zygote(721): Zygote: pid 721 has INTERNET permission, then set capability for CAP_NET_RAW
02-10 00:10:27.135: I/ApplicationPackageManager(721): cscCountry is not German : H3G
02-10 00:10:31.145: I/MapActivity(721): Handling network change notification:CONNECTED
02-10 00:10:31.145: E/MapActivity(721): Couldn't get connection factory client
02-10 00:10:31.145: V/InputMethodManager(721): onWindowFocus: null softInputMode=288 first=true flags=#10100
02-10 00:10:31.145: V/InputMethodManager(721): Has been inactive! Starting fresh
02-10 00:10:31.145: V/InputMethodManager(721): focusIn: com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0
02-10 00:10:31.145: V/InputMethodManager(721): checkFocus: view=null next=com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0 restart=true
02-10 00:10:31.145: V/InputMethodManager(721): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0
02-10 00:10:31.145: V/InputMethodManager(721): Starting input: tba=android.view.inputmethod.EditorInfo@47e2c870 ic=null
02-10 00:10:31.175: V/InputMethodManager(721): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0 ic=null tba=android.view.inputmethod.EditorInfo@47e2c870 initial=true
02-10 00:10:31.495: V/InputMethodManager(721): Starting input: Bind result=InputBindResult{null com.swype.android.inputmethod/.SwypeInputMethod #5}
02-10 00:10:32.265: V/InputMethodManager(721): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0
02-10 00:10:32.265: V/InputMethodManager(721): Starting input: tba=android.view.inputmethod.EditorInfo@47d57038 ic=null
02-10 00:10:32.265: V/InputMethodManager(721): Starting input: finished by someone else (view=com.android.internal.policy.impl.PhoneWindow$DecorView@47de52e0 conn=false)