Indeed GoogleMap
object not show all places by default. Seems you should use Place Search from Google Places API and get list of points of interest via nearby URL request:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=<LAT_LNG_e_g_ 32.944552,-97.129767>&types=point_of_interest&radius=<RADIUS_IN_METERS>&sensor=false&key=<YOUR_APP_KEY>
parse it and show desired places on map programmatically.
NB! Nearby URL request returns only 20 places, for load more data you should use string value from next_page_token
tag of response and pass it via pagetoken
parameter for next request:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=<LAT_LNG_e_g_ 32.944552,-97.129767>&types=point_of_interest&radius=<RADIUS_IN_METERS>&sensor=false&key=<YOUR_APP_KEY>&pagetoken=<TOKEN_FOR_NEXT_PAGE_FROM_next_page_token_TAG_OF_RESPONSE>
Before add markers of POI may be you need to hide "standard" markers, like in this answer of Jozef:
You can do it simply by modification of the map style: Adding a
Styled
Map
- Create JSON file src\main\res\raw\map_style.json like this:
[
{
featureType: "poi",
elementType: "labels",
stylers: [
{
visibility: "off"
}
]
}
]
- Add map style to your
GoogleMap
googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.map_style));
And don't forget to enable Places API for your application from Console.
Or, you can do the trick: use simple WebView
instead of MapFragment
and open it for necessary place:
WebView webview = (WebView) findViewById(R.id.web_view);
webview.setWebViewClient(new WebViewClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://maps.google.com/maps?q=32.944552,-97.129767&z=20");
WebView
shows same Points of Interest as web browser.