Skip to content

Mappls Nearby Search Widget

Introduction

The Mappls Nearby Widget makes it easy to integrate the functionality to search nearby POIs for selected categories in your Android application. The Nearby Search widget provided as a means to enable radially search for Nearby Places on Mappls Maps.

The widget offers the following basic functionalities:

  • Ability to search for nearby places directly with Mappls Maps visual interface.

  • A single method to initiate nearby search across all categories of places available on Mappls.

  • Ability to get information from Mappls Nearby Search widget through a callback.

This can be done by following simple steps.

Dependencies

  • Add below dependency in your app-level build.gradle

Kotlin (build.gradle.kts)

// When using the BoM, you don't specify versions in Mappls library dependencies
implementation("com.mappls.sdk:nearby-ui")

//Or Add Dependency with Version
implementation("com.mappls.sdk:nearby-ui:2.0.0")

Groovy (build.gradle)

// When using the BoM, you don't specify versions in Mappls library dependencies
implementation 'com.mappls.sdk:nearby-ui'

//Or Add Dependency with Version
implementation("com.mappls.sdk:nearby-ui:2.0.0")

Launching Nearby Widget

There are two ways to implement Nearby Search widget:

  • Using MapplsNearbyFragment
  • Using MapplsNearbyActivity

Using MapplsNearbyFragment

Add MapplsNearbyFragment in your activity:

Kotlin

val nearbyFragment: MapplsNearbyFragment= MapplsNearbyFragment.newInstance()
supportFragmentManager.beginTransaction().add(R.id.fragment_container, nearbyFragment, MapplsNearbyFragment::class.java.simpleName)  
        .commit()

Java

MapplsNearbyFragment nearbyFragment = MapplsNearbyFragment.newInstance();

getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, nearbyFragment, MapplsNearbyFragment.class.getSimpleName())  
        .commit();  

To get the selected nearby place use IMapplsNearbyCallback interface:

Kotlin

nearbyFragment.setMapplsNearbyCallback(object : IMapplsNearbyCallback {  
    override fun getNearbyCallback(nearbyCallback: NearbyAtlasResult) {  
        //Select place  
    }  
})

Java

nearbyFragment.setMapplsNearbyCallback(new IMapplsNearbyCallback() {  
    @Override  
    public void getNearbyCallback(NearbyAtlasResult nearbyAtlasResult) {  
       // Select place
    }    
});

Using MapplsNearbyActivity

Add MapplsNearbyActivity in your activity:

Kotlin

val intent = MapplsNearbyWidget.IntentBuilder().build(this)   
startActivityForResult(intent, 101)  

Java

 Intent intent = new MapplsNearbyWidget.IntentBuilder().build(this);   
 startActivityForResult(intent, 101);  

To get the selected POI:

Kotlin

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {    
    super.onActivityResult(requestCode, resultCode, data)    
    if(requestCode == 101 && resultCode == Activity.RESULT_OK) {    
        val place: NearbyAtlasResult? = MapplsNearbyWidget.getNearbyResponse(data!!)              
    }
}  

Java

@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {    
    super.onActivityResult(requestCode, resultCode, data);    
    if (requestCode == 101 && resultCode == RESULT_OK) {    
        NearbyAtlasResult result = MapplsNearbyWidget.getNearbyResponse(data);    
    } 
} 

For any queries and support, please contact:

Email us at apisupport@mappls.com

Support Need support? contact us!



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