Get complete information when you click on the icon that is on the Android Google Map
I want the Institute, Company, company name along with this address when I click the icon that is on Google Map.
Example: - In the Google Map app, when an icon is clicked, it will display the complete information and address for that icon.
Find three images. There, when I click the "HealthCare Global Enterprise Ltd." icon, then it gives the full address with the hospital name at the top of the screen.
I am using Geocoder to get an address for a specific latitude longitude. I get street, country, pincode, etc. but cannot get institute, company, company name.
The hospital name is here: HealthCare Global Enterprise Ltd.
Code: -
private String getCompleteAddressString(double LATITUDE, double LONGITUDE) {
String strAdd = "";
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
StringBuilder strReturnedAddress = null;
try {
List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
if (addresses != null) {
System.out.println("Address Size ->>: " + addresses.size());
System.out.println("Address 0th Position ->>: " + addresses.get(0));
Address returnedAddress = addresses.get(0);
strReturnedAddress = new StringBuilder("");
for (int i = 0; i < returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
System.out.println("*****************************");
System.out.println("Admin Area: ->> " + returnedAddress.getAdminArea());
System.out.println("Country Code: ->> " + returnedAddress.getCountryCode());
System.out.println("Country Name: ->> " + returnedAddress.getCountryName());
System.out.println("Feature Name: ->> " + returnedAddress.getFeatureName());
System.out.println("Admin Area: ->> " + returnedAddress.getLatitude());
System.out.println("Latitude: ->> " + returnedAddress.getLocality());
System.out.println("Longitude: ->> " + returnedAddress.getLongitude());
System.out.println("Max Address Line Index: ->> " + returnedAddress.getMaxAddressLineIndex());
System.out.println("Phone: ->> " + returnedAddress.getPhone());
System.out.println("PostalCode: ->> " + returnedAddress.getPostalCode());
System.out.println("Premises: ->> " + returnedAddress.getPremises());
System.out.println("SubAdminArea: ->> " + returnedAddress.getSubAdminArea());
System.out.println("SubLocality: ->> " + returnedAddress.getSubLocality());
System.out.println("SubThoroughfare: ->> " + returnedAddress.getSubThoroughfare());
System.out.println("Thoroughfare: ->> " + returnedAddress.getThoroughfare());
System.out.println("Url: ->> " + returnedAddress.getUrl());
System.out.println("*****************************");
}
strAdd = strReturnedAddress.toString();
Log.w("My Current loction address", "" + strReturnedAddress.toString());
} else {
Log.w("My Current loction address", "No Address returned!");
}
} catch (Exception e) {
strReturnedAddress.append("Address Not Avilable");
strAdd = strReturnedAddress.toString();
}
return strAdd;
}
source to share
Please take a look at the Google API collector , which can be helpful in determining which Google API to use to retrieve the data you use while searching. Based on your question, it looks like you want to provide a company name or company name, plus additional details. It is available through the Google Place API , below is its summary.
"Get the name, address, opening hours, and other details of a place, including customer ratings and reviews."
This is a type of REST API, you can provide location coordinates and return the data as JSON. See this question and the answer to the code snippet request .
source to share