I'm trying to build an Android application that needs to show some places on the map with custom markers. When the marker clicked it shows the snippet, however, for my application I need to show the Google maps info about the place as in Google Maps application shows. My XML is simple:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
I've two problems:
The Points of Interest from Google Maps are not clickable. Their icon visible on the map but they are not clickable.
When my custom marker clicked I want to show the Google map's info, not my snippet.
Are there ways to achieve these?
For p.1:
At first hide all "default" Points of Interest from Google Maps like in this answer of Jozef:
Than use Place Search from Google Places API and get list of points of interest via nearby URL request:
parse it and show desired places on map programmatically as yours clickable markers.
NB! Nearby URL request returns only 20 places, for load more data you should use string value from
next_page_tokentag of response and pass it viapagetokenparameter for next request:And don't forget to enable Places API for your application from Console.
For p.2:
Use info from p.1 (Place Search) and suggested by Vadim Eksler in his comment Place Details in Google Maps Android Custom Info Window like in this example: