[SDK] Geocoding and Search address with more details

Issue

By default, geocode and search result of an address only contains a title while other details are missing as follows:



Cause

The current result is expected and well documented at:
https://www.here.com/docs/bundle/sdk-for-android-navigate-api-reference/page/com/here/sdk/search/Place.html#getaddress

Note that while OfflineSearchEngine includes as many details as are available, SearchEngine includes only Address.addressText. Complete address details can be obtained by searching with PlaceIdQuery.

Sample code is available in the SDK example app - Search:

https://github.com/heremaps/here-sdk-examples/tree/e9ab517a4910d30634e46719412c728308eaa845/examples/latest/navigate/android/Search

Debug the Search example app and inspect the "placeAddress" variable as follows can get the screenshot that is shared in the Issue section:



Resolution

As stated in the above-mentioned documentation, complete address details can be obtained by searching with PlaceIdQuery.

You can get sample codes of its implementation by searching "PlaceIdQuery" in the SDK example repository, for example, the following for Android:

https://github.com/heremaps/here-sdk-examples/blob/e9ab517a4910d30634e46719412c728308eaa845/examples/latest/navigate/android/CartoPOIPicking/app/src/main/java/com/here/cartopoipicking/MainActivity.java#L219

Implementing in the Search SDK example app in the similar way as follows:



Result

Note the "fetchAddressDetails" function is called in the "autosuggestCallback" of "searchEngine.suggestByText" function.

While the address of the place returned in "autosuggestCallback", the first time search, does not contain details, the second time search has details.

Debug and inspect the second placeAddress in the above share screenshot in the Resolution section can get the following result:



Reference

The full complete project that can replicate the issue (the first placeAddress) and the resolution (the second placeAddress) is available at:
https://github.com/ling-jiang-here/here-sdk-use-cases/tree/main/search-address-details