5

I am currently developing some map'ish application and I would like to support huawei phones that rely on HMS services. I've managed to implement map and markers, but I have problem with geocoding coordinates, with google its simple we have Geocoder and in HMS I don't see anything similar, I've been looking at the site package but doesn't look like this should be used, I've also seen that they do have geocode and reverseGeocode but in JS library, no such thing exists in the android hms map library.

Maybe anyone has faced similar problem already and has some tips on how to geocode my coordinates using hms ?

user2141889
  • 2,255
  • 5
  • 23
  • 25
  • having recently worked with HMS i've struggled just as much with finding documentation for certain features/replacements, hopefully someone has an answer for you – a_local_nobody Jul 21 '20 at 13:11

2 Answers2

0

Which Geocoder are you using? https://developer.android.com/reference/android/location/Geocoder ? If it's this one, then this functionality is outside of Google Play Services and therefore available on HMS as well.

HMS SiteKit is an alternative to Google Places.

Adi B
  • 819
  • 1
  • 8
  • 11
  • 1
    Should it? I've just checked exactly and on HMS devices it throws `IOException: Fail` also I've found this thread few days ago https://stackoverflow.com/questions/38182203/android-reverse-geocoding-not-working-on-huawei-device it now suggests to use `Place Search Suggestion` but this doesnt look accurate tbh – user2141889 Jul 21 '20 at 20:34
  • I tried the code snippet (from your link) on a P40 and the reverse geocoding is working just fine, check this screenshot: https://pasteboard.co/JiNvorM.jpg – Adi B Jul 22 '20 at 07:50
  • Could you provide more details, such as on which device you get the exception or is `Geocoder.isPresent() == true` ? – Adi B Jul 22 '20 at 07:52
  • 1
    android.location.Geocoder.getFromLocation() crashes with java.io.IOException: Service not Available on huawei devices. i tested on P40 – deviant Feb 12 '21 at 13:37
0

You can use huawei HMS Geocoding(forward and Reverse) to get address from latitude and longitude vise versa. HMS SiteKit is an alternative to Google Places. Please check below link for more detail,its alter

https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/webapi-forward-geo-0000001050163921-V5