方法isProviderEnabled()返回意外结果

时间:2013-11-17 13:21:46

标签: android localization geolocation gps provider

检查GPS服务使用方法isProviderEnabled()的LocationManeger,似乎总是返回TRUE,evan当它明显关闭时。我知道这里有一个类似的问题,但是知道方法是否真的不正常或我做错了会很好。方法locationManager.requestLocationUpdates是否会对这个方法产生任何影响?

1 个答案:

答案 0 :(得分:0)

我刚刚在这里发布了类似问题的人的回答。

    private void CheckEnableGPS(){
                String provider = Settings.Secure.getString(getContentResolver(),
                  Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
                   if(!provider.equals("")){
                       //GPS Enabled
                    Toast.makeText(AndroidEnableGPS.this, "GPS Enabled: " + provider,
                      Toast.LENGTH_LONG).show();
                   }else{
                    Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
                       startActivity(intent);
                   }   
               }

我想避免这个cos并不能真正解答我的问题,但是从我在本论坛上找到的内容来看,除了它不起作用的信息之外,我不能指望其他任何事情。这关闭了主题。