-1

I am developing a mobile app and website that allow users to advertise their items only in the UK. However, I don't want the return address to show the full address of the seller on the advert but instead should show the town and the city

For example, 395 Frances Street, London, SE18 5JU, England, UK. This address is in Greenwich town. I just want the location on the advert to show only the town and the city. For example (Greenwich, London)

I mean I would like to restrict the address not to show the full address but specific town and city. Please what is the best solution and how do I achieve this. any suggestion would be appreciated.

1 Answers1

0

You can use Geocoding API if you have the street address and check the "address_components" in the response or use the Places API to request Address Components about the place (Place.Field.ADDRESS_COMPONENTS if using the Places SDK for Android and GMSPlaceFieldAddressComponents if using the Places SDK for iOS). Both will return the address broken into components so you can select which components to display. Each component type is explained in documentation though it may take some experimentation to know which administrative_area_level_N corresponds to the concepts of "town" and "city" in your area.

devangela
  • 103
  • 4