Does the geocoder work on emulators

前端 未结 1 745
抹茶落季
抹茶落季 2021-01-21 00:10

I am using the geocoder and it worked just fine on my device but not working on emulators tried it on 2.2 and 4.2.2 didn\'t work;

this is my code:

Geocod         


        
相关标签:
1条回答
  • 2021-01-21 00:42

    There is no Geocoder installed on emulators. Accroding to Geocoder reference

    The Geocoder class requires a backend service that is not included in the core android framework. The Geocoder query methods will return an empty list if there no backend service in the platform. Use the isPresent() method to determine whether a Geocoder implementation exists.

    You should have checked

    Geocoder.isPresent()
    

    Before accessing the API. It's more reliable to use your own implementation. Check this answer for my implementation. problems with android.location.geocoder

    0 讨论(0)
提交回复
热议问题