how to retrieve region and province from gps android - android

I'm new to android programming and I'm wondering if it's possible and how to retrive from the current position (I don't even know how to retrieve it) the region and the province.
Could you please post some code or tell me where I can find it?
Thanks!!!!!!
Matteo

GPS TRACKING IN ANDROID PHONE:
You can retrieve current location of the mobile phone using Android Location Manager.
Tutorial Reference: GPS Tracking
REVERSE GEOCODING WITH AVAILABLE LAT LONG:
For getting the region and province, after getting current lat/long from phone, you can use the google reverse geocoding API that can be consumed via web-service.
The Google Reverse Geo-coding API is : https://maps.googleapis.com/maps/api/geocode/json?
Usage would be a GET REQUEST like : https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452
(You won't get a response if you just copy and paste the URL in browser)
(API Key is also not required for limited usage)
Reference : Reverse Geocoding

First, find the location of your user using the Location Manager.
Then, pass the location to Google's Geocoder for the address (it contains the state, province and more)

You can also use the methode of Geocode class's (android.location) : http://developer.android.com/reference/android/location/Geocoder.html

Related

Finding route with HERE offline

I want to find a route with HERE but offline.
The target of the route should be human readable text (like Berlin) and not latitude/longitude values.
Now I'm using RoutePlan class which requires lat/long values, and I'm using Geocoder to translate readable text to lat/long values.
But in offline mode (no WiFi, no Cellular Data) I can't use Geocoder to get the lat/long of a place.
How nonetheless can I use HERE maps in offline mode to find a route?
Are you using the HERE android SDK? If so, you most certainly can.
What you need are two things:
1: Download some maps via our MapLoader APIs.
2: Set MapsEngine#setOnline(false) to change the engine to offline only mode.
Geocoding will work offine if the data is downloaded. Routing, guidance and and map rendering will work too.
In addition to David Leong's answer, I had to use HERE's GeocodeRequest instead of Geocoder to get the latitude and longitude.
Example at https://developer.here.com/mobile-sdks/documentation/android-starter/topics/geocoding.html

Android - Maps API - Check the current address location type

I was wondering as to whether it is possible to get the current location type based on the address. The implementation is that using GPS I will be able to get the address of the current location (similar to dropping pins on Maps and getting the address).
What I would like to know is whether based on the address, can I get the type of the location for example whether it is a movie theater, hospital, a restaurant, shopping mall, etc.
Has anyone tried to implement this?
Yes. You can use the Geocoding API to get the place_id. This is a unique identifer that can be used with other Google APIs, like the Places API. This gives more information (name, ratings, etc).

Error to convert latitude and longitude to location description

I'm developing an Android app to integrate with another app.
In this app I need get the current user location and send it to the other app.
I'm getting the latiude and longitude using the following web service:
https://maps.googleapis.com/maps/api/geocode/json?address=Rua+Vergueiro,+1883,+S%C3%A3o+Paulo,+Brazil&sensor=true
The problem is that when the other app receive the latitude an longitude and convert it to address description, an wrong address is showed to the user.
The other app is using the here.com web services to convert the latitude and longitude to address description and Im using googleapi.
Anyone knows tell me what may be happening?
Thanks.
You are geocoding using one service (i.e. Google) and reverse geocoding using a second service (i.e. HERE) and the underlying data is different for each one. As it happens, the location you are looking for is at a junction as shown here
If you run a reverse geocoding search for this location, then the closest location found by HERE is around the corner at Rua Jardim Ivone - the second closest result found by HERE is the same as Google - Rua Vergueiro. As you can see from the picture this is correct - the closest house on the map to the stated location given is actually around the corner.

Android Google Map - how to display all address of matching location?

I have a form in which user will type his address but i want to create such widget for address so that whenever user types his address, then all similiar location will be listed in the suggestion box and user can select his location.
Similiar functionality i have seen in google map navigation application.
Can you please tell me how create such feature?
If you are talking about matching places for a street address, this should work:
use reverse geocoding to convert it into (latitude, longitude) pair, both Android itself and Google API provides this service;
use Google Places API to obtain nearby places using the pair of coordinates
I have a project which actually does the similar job, while due to some reasons it is not public, but I can assure you this way could work.
Hope it helps.

How to get Latitude and Longitude from mobile device Android

In my application I want to use the users' current latitude and longitude. I use the following example.
Still I did not get the answer.
Can emulator displays the latitude and longitude?
How shall i get latitude and longitude from the IP address??
quick response will help me a lot.
There are some different APIs you can use to get a IPs location. This post mentions a few.
Your linked answer uses GPS to get the current position. The Emulator does not have a working GPS-module, so when testing this in the emulator, you can add fake-data for the lat. and long. so you can test the code. More here: How to emulate GPS location in the Android Emulator?
If you want to get a location on an IP-address, you can use certain services for that. This has already been discussed here: What's the simplest way to get a user's latitude and longitude from an ip address
As mentioned in the linked post, I'm not sure about the accuracy of those services.
I dont think there is a possibility to return position data from an IP adress possibly the country but not pin point exact (altitude, longtitude) therefor you need to return device gps data wich is transfered though the internet but has nothing to do with an IP adress..
I have finally found my mistake. the example given HERE works fine.
And the mistake was mine. In the location Setting in my mobile, i forget to check the mobile networks option. once i checked tat option i got the latitude and longitude for my current location.
Try http://www.iptolatlng.com/ , it provides JSON and JSONP results

Categories

Resources