2013-04-14 42 views

回答

0

在第一个教程中,没有提及您需要在Android中使用Google地图的Google地图API V2密钥。另外,第一个教程适用于已弃用的Google Maps API V1。

第二个教程是definitly你所需要的。如果您的位置错误,可能是因为没有使用GPS。检查是否GPS被打开,你必须在你的AndroidManifest.xml这些行:

<uses-feature android:name="android.hardware.location.network"/> 
<permission 
     android:name="cz.nuc.wheelgo.permission.MAPS_RECEIVE" 
     android:protectionLevel="signature"/> <!-- replace name of the package by yours --> 
<uses-permission android:name="cz.nuc.wheelgo.permission.MAPS_RECEIVE"/> 
<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"/> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> 
<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true"/> 
<meta-data 
      android:name="com.google.android.maps.v2.API_KEY" 
      android:value="AIzgkugSgsghsei2256Y7XN6xSGj-o"/> <!-- your key --> 

为了使在地图上使用您的位置:

GoogleMap mMap; 
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); 
mMap.setMyLocationEnabled(true); 

我建议你采取的样品来看看Android-sdk的路径:android-sdk\extras\google\google_play_services\samples\maps\