I am trying to figure out the meaning of setCostAllowed() setting for GPS criteria. Android documentation says "Indicates whether the provider is allowed to incur monetary cost."
Who cares if provider is incurring any costs? I never seen a line on mobile bill that says "gps charges". Has anyone ever been charged for this?
If not, why not just set it always to 'true' and forget?
Ideally this is something I'd like to give the end user control over, however putting this option in application GUI may only raise more questions to which I don't myself have an answer. Does anyone have an explanation for this setting?
The reason for the setting is that not all mobile plans include an unlimited data package, thus customers are charged a per-use fee for data, which includes GPS data. So, it's necessary to ask users if it's okay to incur costs on their behalf for data that your application consumes (i.e.: give them the opportunity to opt-out).
The Criteria for requestLocationUpdates is used to choose the 'appropriate' provider depending on the parameters specified in the Criteria. Sometimes this may refer to having the NETWORK_PROVIDER which in-turn may result in a data connection having some cost incurred on the user.
Related
I need to get the cost of call after the call is ended, ie, the Cost per call as subscribed with the Service Provider. Is there anyway to get this information on the device programmatically?
Thanks
This cannot be possible.
Cost per call is dependent on the Service Provider (Carrier).
Carrier charges depends on so many factors like the plan you have selected and the like. For postpaid cards, this is even more difficult because there might be applicable discounts etc.
May be, you can consider discussing directly with the service operators and ask for their APIs (IF any) and calculate the last call cost.
I dont think this is possible.Theres no way for your app to get the values unless you provide them.
I have two different classes in my application that implement LocationListener. One of them is only used as needed to get the user's current location, while the other is constantly run in the background to keep data on the user's speed.
On my test device, this causes no problems. Some other people testing however have said that their device "locks" (I have not seen this occur, so I'm unsure what they truly mean by this) when trying to acquire the location.
Is it possible that this is just their phone having a weak GPS fix, or could this be some weird hardware issue that occurs when two different threads are trying to gain the location via GPS? If so, what's the best way to work around this? Thanks.
I would suggest you use the new fused provider that is part of Google Play Services. I would not set two LocationListeners. Since you will be constantly tracking the user's location, by using the new LocationClient you can use its getLastLocation() to retrieve the most recent best, cached location the device has, which is really likely to be one from the constant updates you are already retrieving. The fused provider will also determine which one is the best provider to take the location from, you do not need to worry about that logic.
I am developing an app which can record user's location througout the day so app can find out the approx lifestyle of user. app has to collect data in the background at some interval so i need a best strategy to invoke a location update request to LocationManager of android. But it must be optimized in terms of battery and balanced in terms of accuracy.
Right now the flow in my mind is,
iterate through the location providers, give higher priority to NETWORK (as it consumes less power), o this for each,
get the last known location
get the current loction
chek if current is better than last
if yes make this the best estimate, otherwise get location from other provider
i know two parameters which can decide when to invoke location update request,
minimum interval
minimum distance
first i would give them some default value but these must be updated later by using the location history of user and considering other factors in mind like
reduce the frequency of update request if battery is < 75% and further reduce it when
battery is < 50%
increase frequency of update request when user is moving fast (Activity Recognition Class
from google location services can help here)
if we predict the time windows in which user does not move (from history), decrease the
frquency of location updates
use GPS minimal time because it consumes more battery
So these are the pieces that came to my mind but it looks like a mess right now because it is not well structured. So if somebody can help me to add something more in this or can suggest some better strategy (battery must be optimized) i would be very thankful and it was long so please control your emotions if you think i have wasted your time. Thanks
In order to get a good accuracy, Google provides an algorithm that provides, in my opinion, good results. You can find it there : reference
GPS take so time to have a fix, I would say about a minutes (depends on the device).
I would suggest you to look at the Passive Mode, which allows you to receive position without making a fix by using other applications requests.
passive: A special location provider for receiving locations without actually initiating a location fix. This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will return locations generated by other providers. Requires the permission android.permission.ACCESS_FINE_LOCATION, although if the GPS is not enabled this provider might only return coarse fixes.
gps tutorial
Hope it helps !
I'm developing an application on both the android and iPhone simultaneously. Due to the nature of my geolocation application, it's important that the information is really coming from a phone, and not just an emulator that happens to have the application installed.
Is there some kind of value I can pull from the device(s) to determine if its an emulator? I don't want users cheating the system by simply setting their own values for their lat/long coordinates. I know nothing is fool proof, but I would at least like eliminate as much fraud as possible.
I plan to have algorithms in place to validate data being recieved, such as jumping n. miles in n. seconds from your last location -- but this could cause false positives in some situations -- especially on some Androids, where you can magically be placed all over the world moving 2 feet.
This is applicable to both the Android and iOS. Answers for either phone would be fine.
You can use [UIDevice currentDevice].model to get the current device model for iOS. The UIDevice class reference will give you the possible constant strings which you can compare to. Scroll down to the model property for more info.
Don't have much experience with android, however this should work.
With Android, as it turns out, it's a bit more complicated than just determining whether or not you're on an emulator (which can be done using Peter's link above), given the ability, under "Development Settings" to allow Mock Locations (see, for example, this app that allows the user to set a mock location that will then be made available to other apps).
Depending upon the method you're using to retrieve the location provider (e.g., calling LocationManager.getProvider() using the return value from LocationManager.getBestProvider()) you could therefore end up using a Mock Provider. I've been unable to find any definitive method for determining whether a provider is Mock or not (e.g., there's no property of the LocationProvider that indicates it is Mock, no property of the Location that indicates it's fake, etc.). What you could, however, do is read the Secure Settings to determine whether or not ALLOW_MOCK_LOCATION is enabled and not allow your app to function in this case; since the setting is one of the Secure Settings, there is no way to change it programmatically.
I'm designing a location-based service where reliability plays a role.
I wish my users to know that the provided location of other users is real.
I researched mock locations a bit, and noticed in this thread the app LocationSpoofer. I don't have a rooted phone currently, but it states that when rooted it can mock locations even without the setting.
Is there any known way to protect against that? I could use some simple heuristic to verify that the user didn't travel from France to Hawaii in 30 minutes, but I would rather have complete protection.
Thanks ahead!
Instead of a long comment:
"reliability plays a role"
As long as your provide reliable output for "reliable" input i think you will be OK without having to handle 'spoofed' or fake input. In case you have data stored in persistent storage you could handle cases for 'suspicious' data.
That is define and apply scenarios on your data to identify cases like "the user traveled from France to Hawaii in 30 minutes", and handle such cases in an appropriate way. Or you could even reject data that are not realistic.
From a security point of view you should assume that any data coming from a client-side validation process cannot be trusted. The data could be intentially, or unintentionally, modified and that is out of your direct control.
If you want to protect against location spoofing then I would recommend server side checks.