问题
I am trying to redirect the user to Location Settings Screen using an
Alert Dialog to so that he can enable the GPS, But after I enable
the Use Wireless Network checkbox on Api 2.3 and return to previous Activity
its again showing me the Alert Dialog for settings screen.
because this line :
isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
is always returning false.
I am using below code to redirect to Locations Setting.
Intent im=new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(im);
But on Api 5.1.1 the same code is working fine and returning true
Why is it so ?
Thanks In Advance...
回答1:
Actually the device with version 2.3 that I was using for testing was not having GPS so I was always getting the value false and I figured it out when I accidently read my phone's specification
来源:https://stackoverflow.com/questions/34289165/isproviderenabledlocationmanager-gps-provider-always-returns-false-in-android