>>>>> "Jake" == Jake Colman <[email protected]> writes:
Jake> My user tells me that the phone is in good working order, that Jake> he uses it to make phone calls, and that his GPS is functioning Jake> and on. So here is what I need to understand: Jake> 1) Why would getBestProvider return null? Shouldn't it always Jake> be able to tell me something? Jake> 2) Why would a network provider be disabled? Shouldn't that Jake> always be available - assuming that you are not in airplane Jake> mode and can make phone calls? Jake> 3) If the GPS is on, shouldn't my code pick up the GPS if Jake> network is disabled? I ran some tests. I configured my app with ACCURACY_FINE_LOCATION permission and with a criteria of FINE_LOCATION. In that situation: 1) If the GPS and Network are both enabled it will return GPS as best provider. 2) If only Network is enabled it will return Network as best provider. The above makes sense and is logical. But it doesn't solve the problem of preferring to use Network in lieu of GPS when both are available. If, however, you have ACCURACY_FINE_LOCATION permission but use a criteria of COARSE_LOCATION, then the following will be true: 1) If the GPS and Network are both enabled it will return Network as best provider. 2) If only Network is enabled it will return Network as best provider. 3) If only GPS is enabled it will return GPS as best provider. The conclusion: in order to use GPS -- even just as a fallback for when Network is not enabled -- you need ACCURACY_FINE_LOCATION. In that case, if your criteria is COARSE_LOCATION you will pick up Network if available instead of GPS but it still use GPS if it has no other choice. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

