Because there is no provider to match your criteria. Most likely because both providers don't have "POWER_LOW". You can figure out the exact answer by removing Power constrain from the criteria and checking the output.
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 -- 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

