Skip to content

Instantly share code, notes, and snippets.

@barikoi
Last active September 10, 2023 08:57
Show Gist options
  • Save barikoi/ff504f6cbc706db0282c66cf397d7c03 to your computer and use it in GitHub Desktop.
Save barikoi/ff504f6cbc706db0282c66cf397d7c03 to your computer and use it in GitHub Desktop.
#docs #androidLibrary
NearbyPlaceAPI.builder(getApplicationContext())
.setDistance(.5) // distance unit in KM
.setLimit(10) // return places list size
.setLatLng(latitude, longitude)
.build()
.generateNearbyPlaceListByType(new NearbyPlaceListener() {
@Override
public void onPlaceListReceived(ArrayList<NearbyPlace> places) {
Toast.makeText(MainActivity.this, ""+places.get(0).getAddress(), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(String message) {
Toast.makeText(MainActivity.this, "Error: "+message, Toast.LENGTH_SHORT).show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment