How to use google reverse geocoding with react native Expo?

前端 未结 3 747
轻奢々
轻奢々 2020-12-13 22:22

I want to put in my application a button that when pressed return the current address of the cell phone.

The latitude and longitude I am able to return correctly, an

3条回答
  •  悲&欢浪女
    2020-12-13 23:26

    Undestanding your requirement is completed with google api answer,

    But now it is not for free, one cannot use more than free limit other than billing google account.

    So, if you are or anyone working with React-Native-Geocoder , you can implement it like this:

    var pos = {
      lat: 40.7809261,
      lng: -73.9637594
    };
    
    Geocoder.geocodePosition(pos).then(res => {
        alert(res[0].formattedAddress);
    })
    .catch(error => alert(error));
    

提交回复
热议问题