Need Help in getting current location as TEXT

flyingbag

Member
Licensed User
Longtime User
Hello,

I am new to B4A and Android development - less than a few days ...

Currently i am trying to figure out if there is a simple way for my app to return my current position as a string.

So basically - not latitude Longitude - but name of the place like "Howard Street,SF, CA" or "Pandan Valley, Singapore" - like you see in "Google Maps" as your current location ...Approximate location is ok.

Any ideas of how this could be done?

Thanks in advance for your help...

Cheers,
Flyingbag
 
Google's Geolocation API

Hello,
I personally use Google's Geolocation API.

I send the current latitude and longitude to the Google and then I process the page for the correct result.

In the example below, sending my test latitude and longitude location to Google brings back the correct address within 4 houses.

look at all the <formatted_address> in the result below

http://maps.google.com/maps/api/geocode/xml?latlng=52.5413339,-1.9213159&sensor=true

I did some testing and formulated a formula to decide which <formatted_address> to use.
 
Upvote 0
Hello,
I personally use Google's Geolocation API.

I send the current latitude and longitude to the Google and then I process the page for the correct result.

In the example below, sending my test latitude and longitude location to Google brings back the correct address within 4 houses.

look at all the <formatted_address> in the result below

http://maps.google.com/maps/api/geocode/xml?latlng=52.5413339,-1.9213159&sensor=true

I did some testing and formulated a formula to decide which <formatted_address> to use.
Erel - thanks!

Thanks Peter - thats excellent - will give it a try.
 
Upvote 0
Another option is my Geocoder library.

No need to create and send a request to Google and no need to parse the results - the library does all of that for you.

Martin.
 
Upvote 0
Another option is my Geocoder library.

No need to create and send a request to Google and no need to parse the results - the library does all of that for you.

Martin.


I'm using this coordenate but it didn't work, I'm getting "No Address matched the Latitude and Longtidude"

568-570 Empire Blvd
Brooklyn, NY 11225
40.664098, -73.943494

what's wrong ?
 
Upvote 0
Did you have an internet connection with your device while trying the example? you will need it, because the library also connects to a geocoding service via internet.
 
Upvote 0
You are trying to run the Geocoder on a real device?
It will not work on the emulator.

Try rebooting the device - often that fixes this problem.
 
Upvote 0
You are trying to run the Geocoder on a real device?
It will not work on the emulator.

Try rebooting the device - often that fixes this problem.

Excellent, I rebooted it and now it works.

My concern is how often can this happen to the people who have my app ?

thanks.
 
Upvote 0
Back
Top