I am creating an app that uses the google API. I would like to know if i install that app on a mobile phone, will it require a gooogle map app pre-installed in the device to be able to use the map or it uses the internet to get the map from google or any other methods?
This my 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; import
com.google.android.maps.MapView;
public class main extends MapActivity {
/** Called when the activity is first created. */
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(true);
mapV.setBuiltInZoomControls(true);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);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
This my main.xml:
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="00_sJY0o9guZejQwsJOr8PPDHtMpnEB6LWFspjA"
/>
my manifest:
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
android:name=".main"
android:label="@string/app_name" >
Answer
But you can handle id the api is not on phone by
android:required="false" in
How to detect an android device whether it supports google maps API
No comments:
Post a Comment