Per policy it is mandatory show "html_attributions" in the app. This response is received as - "html_attributions" : [ "Listings by \u003ca href=\"http:// Some website.com/\"\u003esSome website\u003c/a\u003e" ]
When I parse it as jObject.getJSONArray("html_attributions") I get -
["Listings by <a href=\"http:\/\/www.some website.com\/\">some website<\/a>"]
This cannot be displayed as is since it is not html correct. Is there any method to parse this attribution correctly so that html valid string is extracted?
Getting startedGo to the Google Cloud Console. Click the Select a project button, then select the same project you set up for the Maps JavaScript API and click Open. From the list of APIs on the Dashboard, look for Places API. If you see the API in the list, you're all set.
Save this answer. Show activity on this post. In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google. That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.
Note that the place ID, used to uniquely identify a place, is exempt from the caching restriction. You can therefore store place ID values indefinitely.
Go through this Google Places Api Sample which describes a way of doing so.
It has a method formatPlaceDetails
that Format details of the place for display. It does not support HTML tags directly, they need to be encoded first.
private static Spanned formatPlaceDetails(Resources res, CharSequence name, String id,
CharSequence address, CharSequence phoneNumber, Uri websiteUri) {
Log.e(TAG, res.getString(R.string.place_details, name, id, address, phoneNumber,
websiteUri));
return Html.fromHtml(res.getString(R.string.place_details, name, id, address, phoneNumber,
websiteUri));
}
string.xml
<string name="place_details"><b>%1$s</b><br/><i>Place Id: %2$s</i><br/>Address: %3$s<br/>Phone: %4$s<br/>Website: %5$s</string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With