Obfuscate location to show a given level of accuracy - android

Let's say that I want to get the lastLocation but with an accuracy no better than 1km, how can I do that? Does Android provide an easy way to do this?
I know that COARSE_LOCATION obfuscate it to a block level, but that isn't enough.
Why I need this? There is a law that requires that in some cases the app shouldnt return an accurate location.

Let's say that I want to get the lastLocation but with an accuracy no better than 1km, how can I do that?
You don't. You get a location. It will have whatever accuracy it has, which you can determine via getAccuracy() on the Location object. Other than by choosing coarse versus fine, you do not have control over the actual accuracy.

Related

LocationProvider - Detecting highly inaccurate/incorrect locations

So I know you can use getAccuracy() to find the accuracy of a location but if you set up a cut off for the accuracy, can you prevent recording down one of those locations where it's hugely off mark of where the user is? Like if the user is still, most location updates cluster around his area but occasionally the location provider will hiccup and report the location as somewhere miles away.
Do these locations simply appear as "accurate" with getAccuracy? Or would they turn up as some insanely high getAccuracy() result? Programming a cut off point is easy enough but I was wondering if I would have to code extra checks such as if a location is way too different from the previous ones then it's a wayward one.
Accuracy is not the only deciding factor here. You should also look at the age of the location, and the provider if you get it (the Google Play Services location doesn't tell you, but the original Android LocationManager does).
In fact, Google has some useful sample code for maintaining a current best estimate. I have used a variation of this to filter out wild jumps in incoming location data. Essentially a location is not even reported if it doesn't pass this gate.

android stable location provider

I'm not sure which location providers I should use:
20 seconds is the maximum time I can manage without location.
The accuracy is less important for me, I can manage with accuracy of 500m.
Take a look at the location manager class. It will give you the information about location. And because you need an accuracy of 500m , I would suggest you to use gps, as networks(assuming you mean cellular) will have a lesser accuracy.

Android - how I can I achieve location accuracy in Google Map

I am self learning Android programming at the moment. I was about to write app that will display my location on map without using GPS.
I have tried using NETWORK_PROVIDER and found that my accuracy is constantly at 2000 even in city area with a lot of wifi around the area.
I would like to know how could other map application (e.g. GoogleMap) is able to achieve high accuracy without using GPS.
They use GPS. Or they lie about their accuracy. Ever seen the big blue circle around your position in Google Maps? That means they think you're somewhere in that circle, and are guessing about actual position.
The only way to get accuracy is to use GPS/GLONASS signals. A-GPS can help to fix position quickly because it provides info about which satellites are in view from your phone cell position (your device don't spend time trying to get signals from satellites not in view).
The 'High accuracy' mode is just a lie from Google to know your position all the time to monetize you in perverse ways
If you are using the network provider to fetch the location they are not very accurate. SO its not a good idea to fetch the accuracy of your position using
network provider. Its best to use GPS to get the location updates. You can use GetAccuracy() method of Location class and see for the value it returns.
Let Say if getAccuracy() retruns 25 then you can leave this value wait for another gps value which is more accurate.

Requesting geolocation with a minimum accuracy requirement

Suppose I'm bound to use one provider, say GPS. I have a minimum accuracy requirement and I need a single signal that satisfies it. What are the best practices?
What I'm doing is I call "requestLocationUpdates" to get continuous locations, then check each one for accuracy and finally call "removeUpdates" when I get a good one.
Should I be doing this with minTime and minDistance set to 0 because the accuracy comes randomly enough? Or should I set some special values to it because, by the nature of GPS, it's likely to keep giving me similar accuracy unless I move away (say from buildings?) or I give it time (say for random atmosphere conditions or satellite positions to change?)? If so, which values would it be?
Note: According to this text, GPS uses more power to get the fix than to get locations afterwords. Which for me means that "requestSingleUpdate" is no good with an accuracy requirement. Is this right?
If you're using NETWORK instead, will it work in the same way?
In your case only solution works:
Set Provider to GPS only, set time and accuracy to best (0),
and decide yourself, e.g by reading attribute estimatedAccuracy from location.
Its true, the initial position finding needs most power, so it makes no sense to enable and disable GPS every 20s. Unfortunetly I dont knwo where the threshold in minutes is where it saves battery when temporary disabling GPS.
The acuiracy requirement currently makes only sense to distinuish between GPS (3-6m) and Network (GSM cell: 1000m) WLAN sometimes will be better than GSM cell locationing, but often is not available, and less reliable.
If you, for your app decide that you need more or less acurate position, then an accuracy requirfement, other than "best" make no sense.

Android : Getting CURRENT coordinates (not lastKnownLocation)

Right now, I only know of one method to do this:
- Get last known location
- Have the location manager request location updates
However, I really only need to get the CURRENT coordinates ONCE right when the application is called, but it's not doing what I want.
What's the simplest way to get the current coordinates? Is there something I could call or some code I could use just to get the location RIGHT NOW ?
thanks in advance! I'm still a little new with android development.
What's the simplest way to get the current coordinates?
There is no way to get the current coordinates on demand.
Is there something I could call or some code I could use just to get the location RIGHT NOW ?
No, for three related reasons:
Not all location technologies are low power. GPS, for example, is a serious battery hog. Hence, GPS is not powered on unless something is actively seeking a GPS fix.
Not all location technologies are instantaneous. GPS, for example, takes some number of seconds to get a fix after being powered on.
No location technology is universally available. GPS, for example, may be unavailable because you are in a large building.

Categories

Resources