I have created simple android application which take current Latitude and Longitude from google api. then it will store that data to server.
My problem is that every time when i am try to get the Location it show me different value. same place and same phone then also it fetches different data.
this problem is very critical because i am doing some functionality based on the difference of the Latitude and Longitude.
can you tell me how can i get the same lat and long in each devices ?
Thanks in advance
Does it display huge differences or just ~50-100m differences? Because GPS isn't exact (plus it depends on connections, ...).
Related
I'm looking to implement, real time location tracking for android apps.
The server would request a specific device's real time location which needs to be shown on google map. can anyone help me with this.
Thanks
use geo coding google api to do this stuff.... through gps in android write a android app, that should send latitude and longitude position for every 10 or 20sec so that you can make a variable for latitude and longitude so that new value get updated and stored
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.
I am developing a POI locator app. I am parsing a JSON file with over 1600 locations. How would effiecntly compare this list to the current users location and get the closest 10?
EDIT
The app is using no server, as I want to use local JSON files.
I fixed it by using a for loop and measuring the distance between the location and the users location.
distance = locationA.distanceTo(locationB);
if (distance <= 1000 * 10) //finding all within 10km Radius.{
ADD GEOPOINT HERE
}
It's better if you can store the 1600 locations in a database(like mongodb) which supports geo spatial queries. you can directly query over the database to determine the closest N no.of locations to the given latitude and longitude of the user.
If you are going to find distance by a birds-view approach you can just query your locations and check distance with formula located here. But if you are going to take roads (graphs) into accounts, I'm afraid you'll need to use some kind of pathfinding service like google maps or roll your own. (As far as I know there is no built-in mechanism in Android.)
We were writing this kind of app as well, and performed some performance tests on MySQL and MongoDB. Because MongoDB is document based and stores its data in json format, location based queries(like closest restaurants to the user) completes and returns incredibly fast. As far as I can remember, it was approximately 10 times faster than MySQL. So, even if your application doesn' t currently use a no-sql database, I strongly suggest you to use MongoDB even just for location calculating part of your project.
I am trying to make a small application using the Google Maps API.
It will display every fastfood location in an area. I know there are already some applications that do the same thing, but I would like to learn and do my own stuff :).
E.g. I have a list of 1000 address, and I would like for every of them to be displayed on the map. S
Should my application send requests 1000 times to Google the longitude and latitude of the location for each time a user would want to use my application?
Or should I store the longitude and the latitude on my database? If so, is there a way to obtain them through a request? I know there is a way to obtain it one by one, not to have all of them.
The Geocoder API has a request limit per API key (you have to obtain one of those): 2500 calls or so per day. I would suggest you use the Geocoder to obtain the Lat and Lon of all your adresses and save them to SQLite, so you can reuse the locations all the time.
Just write a loop that goes through all your adresses, makes the request to google and stores the lat/lon information. If you hit their limit, you can continue the next day.
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