getBestProvider always returns some string. I had sam problem. You
have to add  in manifest following:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"/>

On 3 ožu, 18:40, 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

Reply via email to