API overview
Using the API on Android SDK.

MapView và VietbandoMap
MapView
và VietbandoMap
are important components of Vietbando Android SDK. MapView acts as any other view and its behavior can be changed statically with XML file, or programmed at runtime. You can think of VietbandoMap as the controller for your map. It includes methods for setting and moving camera positions, adding markers, configuring user interaction and more.
Lifecycle method
MapView
has its own lifecycle approach to managing the OpenGL Android life cycle, which must be called directly from Activity. In order for your application to correctly call the MapView
lifecycle methods, you must override the following lifecycle methods in the Activity that contains the MapView
:
onCreate();
onResume();
onPause();
onSaveInstanceState();
onLowMemory();
onDestroy();
XML layout
To add the MapView
, add the following line to your xml file:
<com.vietbando.vietbandosdk.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
vietbando:access_token="<your access token here>"/>
And then you can call it in Activity
:
findViewById(R.id.mapview);
Authentication key
An authentication key is required to use the service and the Vietbando API, such as maps, directions, geocodes. Your authentication keys can be managed in your account settings where you can get current key and create new one. You should create a new key for each of your applications, help you monitor usage and minimize interruptions in case a token must be revoked.
Map type
There are four types of maps:
- Vector Tile Default:
The attribute name is
VIETBANDO_VT_DEFAULT
. - Raster Image Default:
The attribute name is
VIETBANDO_RA_DEFAULT
. - Raster Image Terrain:
The attribute name is
VIETBANDO_RA_TERRAIN
. - Raster Image Admin:
The attribute name is
VIETBANDO_RA_ADMIN
.
To use a particular map type, paste your URL into Vietbando of MapView with vietbando:style_url
attribute. If you want to change the map type later, call VietbandoMap.setStyleUrl ()
to see the results.
Android versions support
Vietbando Android SDK is supported for applications running Android API 15 (Ice Cream Sandwich MR1) or higher. To make sure it works in your app, please set minSdkVersion in App Manfifest not lower than 15.
<uses-sdk android:minSdkVersion="15"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />