According to the docs, all These constrains, but for cost, are supposed to be relaxed until it can find a provider. Because, otherwise, how can I make sure it only uses network even if gps is available?
>>>>> "i" == ip <ip332> writes: i> Because there is no provider to match your criteria. Most likely i> because both providers don't have "POWER_LOW". You can figure out i> the exact answer by removing Power constrain from the criteria and i> checking the output. i> On Mar 3, 8:40 am, Jake Colman <[email protected]> wrote: >> I am using the following code to get a list of all available providers, >> so I can see what's out there, and to select the best provider based on >> my criteria. Why would this code return a list of "[network gps]" for >> all providers but still return null for best provider? >> >> List<String> all = locationManager.getAllProviders(); >> logger.verbose( TAG, "All available location providers: " + >> all.toString() ); >> >> Criteria criteria = new Criteria(); >> criteria.setAccuracy( Criteria.ACCURACY_COARSE); >> criteria.setAltitudeRequired( false ); >> criteria.setBearingRequired( false ); >> criteria.setCostAllowed( true ); >> criteria.setPowerRequirement( Criteria.POWER_LOW); >> >> String provider = locationManager.getBestProvider( criteria, true); >> logger.verbose( TAG, "Best location provider: " + provider ); >> >> I am getting this behavior on the emulator but I suspect that this may >> be the root cause of an issue seen by one of my users. >> >> -- >> Jake Colman -- Android Tinkerer i> -- i> You received this message because you are subscribed to the Google i> Groups "Android Developers" group. i> To post to this group, send email to [email protected] i> To unsubscribe from this group, send email to i> [email protected] i> For more options, visit this group at i> http://groups.google.com/group/android-developers?hl=en -- 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

