我正在创建一个使用Google API的应用 . 我想知道如果我在手机上安装该应用程序,是否需要在设备中预先安装的gooogle Map 应用程序才能使用 Map ,或者它使用互联网从谷歌或任何其他方法获取 Map ?
这是我的main.java:
package com.map.testing; import android.os.Bundle; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController;导入com.google.android.maps.MapView; public class main extends MapActivity {/ **首次创建活动时调用 . * / MapController mControl; GeoPoint GeoP; MapView mapV; @Override public void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);的setContentView(R.layout.main); mapV =(MapView)findViewById(R.id.mapView); mapV.displayZoomControls(真); mapV.setBuiltInZoomControls(真); double lat = 23.1;
double longi = 113.3;
GeoP = new GeoPoint((int)(lat * 1E6),(int)(longi * 1E6));
mControl = mapV.getController();
mControl.animateTo(GeoP);
mControl.setZoom(12);
}
@覆盖
protected boolean isRouteDisplayed(){
// TODO自动生成的方法存根
返回false;
}
}
这是我的main.xml:
<com.google.android.maps.MapView
android:id =“@ id / mapView”
机器人:layout_width = “FILL_PARENT”
机器人:layout_height = “FILL_PARENT”
机器人:启用=“真”
机器人:可点击=“真”
机器人:apiKey = “00_sJY0o9guZejQwsJOr8PPDHtMpnEB6LWFspjA”
/>
</的LinearLayout>
我的清单:
<uses-sdk android:minSdkVersion =“8”/>
<uses-permission android:name =“android.permission.INTERNET”/>
<应用
机器人:图标= “@绘制/ ic_launcher”
android:label =“@ string / app_name”>
<uses-library android:name =“com.google.android.maps”/>
<活动
机器人:“主”名称=
android:label =“@ string / app_name”>
<意图滤波器>
<action android:name =“android.intent.action.MAIN”/>
<category android:name =“android.intent.category.LAUNCHER”/>
</意图滤波器>
</活动>
</应用>
1 回答
但你可以处理id api不在手机上
android:required =“false”in
How to detect an android device whether it supports google maps API