Android, Getting inconsistency in User Current Location.? - google-play-services

I am new in android and wanna get user current location using GPS_PROVIDER, but every time getting different-different location how can I use Google Play Services. and what is the best way to get accurate location in android.
Thanks you.

In general there are two different types of locations available through the Android API.
One is the GPS-Location which only works outdoors and which has an accuaracy between 5m and 50m.
The other kind of location is the so called Network-Location which is a loaction measure based on Wifi Networks in you surrounding and GSM-Base-Stations which have a accuracy between 100m and 1500m. This localization technique also works indoors, because it only requires you smartphone to have network access. The accuaracy gets better in urban areas where a lot of Wifi and GSM-Base-Stations are located. The more GSM-Base-Station / Wifi hotspos are available the better is the accurarcy of the loation measurement. It can also get down to 5m.
When requesting such an location Google does internally some magic to compute the position. This request requires a internet connection (you don't need to explicitly give the permission). Interanally Android sends a request to a Google server which contains fingerprints of the surrounding GSM-Base-Stations and afterwards computes your location (if you are curious you can find the code here).
With GPS-bases location the location accurarcy is the same all over the world without any internet connection, but works only outdoors.
With my applications I implemented a logic which detects if GPS is present or not and if not I switched to network localization, this works fine.

Related

Uploads restarting indefinitely if they fail - Will it happen on 3G/4G

Is there a way to prevent BackgroundTransfer from trying indefinitely to upload a file. Let's say one of my user is trying to upload a movie from the phone to Facebook. Facebook Graph API doesn't accept byte-range/resume/etc. Let's say the network is slow, less than 50 kbps. Under 50 kbps, BackgroundTransferService will restart the upload.
That being said, when testing my app, I've noticed that the uploaded restarted 4-5 times under my very slow 3G wifi router (yeah... I'm a mix of the two cases).
Will this behavior happen on a GSM/3G/4G network?
What think is that this behavior is totally welcome, on a Wifi, but not on a phone network, as data costs more.
[Edit]
I forgot one important info: I don't have internet on my WP, so that's why I ignore the behavior of BTS on a phone network.
Yes, the agent will try and reattempt the transfer if the connection is dropped. This is one of the benefits of using the agent, you let it worry about reattempting and network conditions so you don't have to. The API does all you a level of control over usage of cellular data via the TransferPreferences property. You could set this if you're concerned. Alternatively, let the user set their own preferences about data usage via the built in settings on the phone.
There is more information at http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202955(v=vs.105).aspx#BKMK_TimelinessofCompletion

Tips for conserving battery if CoreLocation must constantly retrieve the user's location?

The application will select a random latitude and longitude to create a point which the user must find.
The user's distance from the point will be displayed using a "hot-cold meter", which will change color depending on the distance. This meter must constantly update, which would require that I constantly retrieve the user's location. I would also need to use kCLLocationAccuracyBest. However, this sounds like it would use up a lot of battery.
Can I do anything to save battery?
From the official documentation
Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device’s battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the service works only on devices with cellular radios.) For most apps, it is usually sufficient to establish an initial position fix and then acquire updates only periodically after that. If you are sure you need regular position updates, you should use the significant-change location service where you can; otherwise, you should configure the parameters of the standard location service in a way that minimizes its impact on battery life.
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
PS: On the same link there's a section at the bottom of the page with other tips too :)
My iphone app runs 8 hours of recording fixes evey second on iphone4. The display needs much more power. Dont worry. Measure how long you can record. Then claim, not before.

Online map locator api like GPS

Google maps, ip location etc. working good.
But none of the services are locating a computer exactly where it is on a map.
Anyone know any api which can locate a computer on a map without user inputs.
I am tired of ip location, it is not at all exact and my client is not happy. :(
Thanks
Gobi
What you're trying to do is not possible without specialized hardware. Google maps on cell phones without GPS uses cell tower station information. Most other phones use actual GPS receivers. With neither of those, the only way for your network-attached computer to tell where it is is by looking at who owns its IP address, which is what the IP location stuff does. Unfortunately, that database has pretty low geographical resolution. If you really want accurate and precise location information, you have to have a GPS receiver.
This cant be done unless you have some GPS device connected to the computer. But I guess it is forbidden in the licence to use real time tracking in Google Maps, but I might be wrong.
There's one more way, but I don't know how practical it is: visible wifi networks. If your PC has wifi hardware then you can often correlate the list of networks that you can see to an approximate location based on databases of networks and position. This is how e.g. iPod touches can locate themselves, and iPhones when there's poor GPS reception in built-up areas.
But even if your end-user has wifi hardware and you can somehow read the network list from it then I'm not sure if there are public datasets for this though.
The W3C Geolocation API allows websites to request the user's best available location from the browser. In some cases this will use IP geolocation which you've already seen to be inaccurate, but it can sometimes do better.
The API is agnostic to the device and the method used to obtain location; on an iPhone, the Geolocation API may use cell tower triangulation, available WiFi network lookup or GPS satellite geolocation, or some combination. On Firefox or Chrome on the laptop, Google uses WiFi networks and IP address to give a location which is often much, much better than IP geolocation alone.
If you had a GPS attached to your computer, it's possible that your browser could take advantage of that too -- it's expected that future versions of Internet Explorer will support the W3C Geolocation API using the Windows 7 Location Platform, which can accept location from an attached GPS or manual entry or some other plugin.

What is the best server side solution for a real-time GPS tracking system

Well, I tried to ask this question as a comment on this question, but I thought that maybe no one will notice it, so I decided to ask it as a separate one.
The question is about how to do real-time GPS tracking system things; if we have the following scenario:
Rather than connecting a GPS receiver to a PC, the user will have a mobile device with an integrated GPS receiver.
Location data will be sent over mobile network using GPRS data connection to a server side.
The data will be processed and a KML path file will be created and updated on time intervals and used to track the user using Google Earth.
The question is: what is the best method to accomplish this scenario for the server side; is it a web service, a web application, a windows service, a windows application or what exactly? Taking into account that the system will serve a number of users simultaneously, and that more users may use the system in the future(scalability issues).
Thank you in advance and I highly appreciate any help :)
What kind of device are you using exactly, something like this or something more sophisticated / configurable? If we assume that the device sends its data over TCP, I would consider the following approach with separate input/output processes:
Input: a process listening specific TCP port and storing incoming coordinates to database with a device id. Preferably, your listening loop must be able to handle simultaneous connections without them blocking each other.
Output: web application reading coordinates from database for a given device id and displaying them through the Google Earth API.
Use whatever programming language(s) you are familiar with.
For me there is a technical limitation/risk here -> the mobile device, and its connectivity.
1) What are your requirements? Do you need to support various mobile devices or will you focus on only one platform ?
2) More importantly, you have to understand that GPRS data connections differ from a PC connected to the Internet. There are various connection restrictions imposed by different mobile operators.
If I was to design such a system in order to minimise those risks I would go with a web server running on port 80 which the mobile devices would upload their Long/Lat through POST (or even GET to simplify things).
EDIT: Regarding scalability, it would be very easy to scale things up in the future using tried&tested load-balancing techniques.
EDIT2: Whichever technology you decide to use, i would HIGHLY recommend that the first thing you do is to mock up a prototype. Those connection restrictions could be show-stoppers. Ideally you need to explore them before you have made any serious investment.

J2ME location API (JSR 179) on non-GPS devices

The Java ME Location API says it supports:
Mobile Network based positioning.
GPS
Short Range Beacons
Quite a number of phones support this API (JSR179). However, some phones don't have an inbuilt GPS module, is it still possible to use this API to obtain the phone's current location?
Mobile Network based positioning.
The security settings will control if you can access this, the service provider may also make a charge.
From my very limited experience of J2ME, you can set the phone to not allow an app access to private data (such as location) and to charged for services (such as location) - you can also set it to popup a request for the user to authorize it.
J2ME is pretty well designed to gracefully fall back to whats available and hide a lot of the details.
Yes, some GPSless S60s (e.g. N70) give location through this API when used with an external GPS device attached via Bluetooth. Others may possibly give you approximate location using CellID.