Tuesday, June 16, 2015

Android Interacting with the Map

Developer can decide which of the built in UI components will appear on the map, which of the gestures are allowed on and how to respond to click events from end users. 

the built in UIControls of the map can be controlled using the UISettings class which is obtained by calling the GoogleMap.getUISettings method. The initial configuration can be specified in the XML file also. Below is a sample XML file 

Zoom control can be specified using the UiSettings.setZoomControlsEnabled(true); 
Compass can be enabled using the UiSettings.setCompassEnabled(true)
For MyLocationButton, map.setMyLocationEnabled(true)
Level Picker which is used for picking which floor, can be enabled using GoogleMap.getUISettings.setIndoorLevelPickerEnabled(true);
MapToolbar : The toolbar that appears at the bottom right of the map. this toolbar gives quick access to the Google map mobile app. UiSettings.setMaptoolbarEnabled(true);

Below are the API settings the gestures 
Zoom Gesture 

- Double tap increases the zoom, 
- two finger tap decreases the zoom by 1 
- two finger pinch/stretch 

scroll/pan gestures . This can be enabled or disabled by UiSettings.setScrollGestureEnabled 
Tilt gestures can be enabled or disabled by UiSettings.setTiltGestureEnabled 
Rotate Gesture UiSettigns.setRotateGestureEnabled 

Below are the settings for Map Events 
Map Click events : If app want to listen to user clicking on specific point in the map, can do so by adding listener onMapClickListener by calling GoogleMap.setOnMapClickListener. This will result in the onMapClick event. Long click listener can be enabled by MapView.setOnLongClickListener

The click events on the map can be altogether avoided if we set false to setClickable. 
OnCameraChangeListener can be used for getting the camera position change events. Indoor map stage changes can be obtained using onIndoorStateChangeListener.

references:

No comments:

Post a Comment