W Washiul Alam Sohan New Member Mar 18, 2017 #1 Hi, I want to create a app that will get my current location, not only lattitude or longtitude, I want my area name..... My area name will show in the app..Is it possi ble? Thanks Sorry for my bad English
Hi, I want to create a app that will get my current location, not only lattitude or longtitude, I want my area name..... My area name will show in the app..Is it possi ble? Thanks Sorry for my bad English
Erel B4X founder Staff member Licensed User Longtime User Mar 19, 2017 #2 It is called geolocation. You will need to use a web service that returns the location. https://www.b4x.com/android/forum/pages/results/?query=geolocation Upvote 0
It is called geolocation. You will need to use a web service that returns the location. https://www.b4x.com/android/forum/pages/results/?query=geolocation
klaus Expert Licensed User Longtime User Mar 19, 2017 #3 Have a look at the Geocoder library. Upvote 0
MarcoRome Expert Licensed User Longtime User Mar 19, 2017 #4 If you call this with lat / lon B4X: https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452 You have this result: { "results" : [ { "address_components" : [ { "long_name" : "277", "short_name" : "277", "types" : [ "street_number" ] }, { "long_name" : "Bedford Avenue", "short_name" : "Bedford Ave", "types" : [ "route" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "277 Bedford Ave, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.7142205, "lng" : -73.9612903 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 40.71556948029149, "lng" : -73.95994131970849 }, "southwest" : { "lat" : 40.7128715197085, "lng" : -73.9626392802915 } } }, "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA", "types" : [ "street_address" ] }, { "address_components" : [ { "long_name" : "Grand St/Bedford Av", "short_name" : "Grand St/Bedford Av", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "Grand St/Bedford Av, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.714321, "lng" : -73.961151 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.71566998029149, "lng" : -73.95980201970849 }, "southwest" : { "lat" : 40.7129720197085, "lng" : -73.96249998029151 } } }, "place_id" : "ChIJi27VXGBZwokRM8ErPyB91yk", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "address_components" : [ { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], Click to expand... Upvote 0
If you call this with lat / lon B4X: https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452 You have this result: { "results" : [ { "address_components" : [ { "long_name" : "277", "short_name" : "277", "types" : [ "street_number" ] }, { "long_name" : "Bedford Avenue", "short_name" : "Bedford Ave", "types" : [ "route" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "277 Bedford Ave, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.7142205, "lng" : -73.9612903 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 40.71556948029149, "lng" : -73.95994131970849 }, "southwest" : { "lat" : 40.7128715197085, "lng" : -73.9626392802915 } } }, "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA", "types" : [ "street_address" ] }, { "address_components" : [ { "long_name" : "Grand St/Bedford Av", "short_name" : "Grand St/Bedford Av", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "Grand St/Bedford Av, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.714321, "lng" : -73.961151 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.71566998029149, "lng" : -73.95980201970849 }, "southwest" : { "lat" : 40.7129720197085, "lng" : -73.96249998029151 } } }, "place_id" : "ChIJi27VXGBZwokRM8ErPyB91yk", "types" : [ "bus_station", "establishment", "point_of_interest", "transit_station" ] }, { "address_components" : [ { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], Click to expand...
Erel B4X founder Staff member Licensed User Longtime User Mar 20, 2017 #5 How to parse this? Here: https://b4x.com:51041/json/index.html Upvote 0