Android Question Get my location

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
 

MarcoRome

Expert
Licensed User
Longtime User
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" ]
}
],
 
Upvote 0
Top