Skip to content

title: Place Picker

Mappls Place Picker Widget

Introduction

The Mappls Place Picker Widget provides a simple and intuitive way for users to select a location on the map.

The widget offers built-in support for map interaction, search, current location access, camera customization, and marker positioning, allowing developers to integrate location selection workflows with minimal effort.

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.1")

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.1")

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)

PlacePickerOptions

Use PlacePickerOptions to customize the appearance and behavior of the Place Picker widget.

Property Description
toolbarColor(Integer) Sets the toolbar color of the Place Picker widget.
startingBounds(LatLngBounds) Opens the map within the specified geographic bounds.
statingCameraPosition(CameraPosition) Sets the initial camera position, including zoom level, center coordinate, bearing, and tilt.
includeDeviceLocationButton(Boolean) Enables or disables the current location button.
marker(Integer) Sets a custom marker drawable displayed at the center of the map.
mapMaxZoom(Double) Sets the maximum zoom level allowed on the map.
mapMinZoom(Double) Sets the minimum zoom level allowed on the map.
includeSearch(Boolean) Enables or disables the search functionality within the widget.
searchPlaceOption(PlaceOptions) Configures the behavior and appearance of the integrated search widget.

Example Configuration

Kotlin

val placePickerOptions = PlacePickerOptions.builder()
    .toolbarColor(Color.parseColor("#3F51B5"))
    .includeDeviceLocationButton(true)
    .includeSearch(true)
    .mapMinZoom(4.0)
    .mapMaxZoom(18.0)
    .build()

Java

PlacePickerOptions placePickerOptions = PlacePickerOptions.builder()
        .toolbarColor(Color.parseColor("#3F51B5"))
        .includeDeviceLocationButton(true)
        .includeSearch(true)
        .mapMinZoom(4.0)
        .mapMaxZoom(18.0)
        .build();

Retrieving the Selected Place

Once the user selects a location and returns from the Place Picker, retrieve the selected Place object.

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!



@ Copyright 2026 CE Info Systems Ltd. All Rights Reserved.