Mappls Place Picker Widget¶
Introduction¶
Mappls Place Picker Plugin can be used to choose a specific location.
Add the dependency¶
Add below dependency in app level build.gradle file
Kotlin (build.gradle.kts)¶
// When using the BoM, you don't specify versions in Mappls library dependencies
implementation("com.mappls.sdk:place-widget")
//Or Add Dependency with Version
implementation("com.mappls.sdk:place-widget:3.0.0")
Groovy (build.gradle)¶
// When using the BoM, you don't specify versions in Mappls library dependencies
implementation 'com.mappls.sdk:place-widget'
//Or Add Dependency with Version
implementation("com.mappls.sdk:place-widget:3.0.0")
Add Place Picker¶
To add the place picker widget
java¶
Intent intent = new PlacePicker.IntentBuilder()
.placeOptions(placePickerOptions).build(this);
startActivityForResult(intent, 101);
Kotlin¶
val intent = PlacePicker.IntentBuilder()
.placeOptions(placePickerOptions).build(this)
startActivityForResult(intent, 101)
You can use PlacePickerOptions
to set the following properties:
1. toolbarColor(Integer)
: To set the toolbar color of place widget
2. startingBounds(LatLngBounds)
: To open a map in a bound
3. statingCameraPosition(CameraPosition)
: To open a map that sets in camera poition you can set zoom, centre, bearing etc.,
4. includeDeviceLocationButton(Boolean)
: To enable/ disable current location functionality
5. marker(Integer)
: To change the marker image which is visible in the centre of a map
6. mapMaxZoom(Double)
: To set maximum zoom level of the map
7. mapMinZoom(Double)
: To set minimum zoom level of the map
8. includeSearch(Boolean)
: To provide opions for search locations
9. searchPlaceOption(PlaceOptions)
: To set all the properties of search widget
Premium Feature¶
The Place Picker widget has the capability to showcase certain premium features if they are provisioned within your project, like:
Highlighting a Building¶
If the selected point on the map falls within a building, then Mappls Place Picker can also highlight the said building on the map. This visualization's color palette is configurable within the Mappls Map SDK.
In order to access this feature, please contact API support as well as your Business relationship manager.
Also, you need to use below properties to use this feature:
1. buildingFootprintsEnabled(Boolean)
: To display Building Foot Print of place picker area
2. buildingAppearanceFillColor(String)
: To set the footprint background color
3. buildingAppearanceFillOpacity(Double)
:To set the footprint background color opacity
4. buildingAppearanceStrokeOpacity(Double)
:To set the footprint Stroke opacity color
5. buildingAppearanceStrokeWidth(Integer)
: To set the footprint Stroke Width
6. buildingAppearanceStrokeColor(String)
: To set the footprint Line Stroke Color
Get Result¶
To get the pick place:
java¶
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(data);
}
}
Kotlin¶
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == 101 && resultCode == Activity.RESULT_OK) {
val place: Place? = PlacePicker.getPlace(data!!)
}
}
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!