在android中使用不同模式获取纬度和经度

时间:2014-12-15 18:46:57

标签: android gps latitude-longitude

我在android

中有一个位置模式快照

enter image description here


检查位置模式的代码!

private void checkLocationModeSettings() {
    int mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE,
            Settings.Secure.LOCATION_MODE_OFF);

    switch (mode) {
        case Settings.Secure.LOCATION_MODE_SENSORS_ONLY:
            Log.d(TAG, "Sensor only mode");
            break;
        case Settings.Secure.LOCATION_MODE_BATTERY_SAVING:
            Log.d(TAG, "Battery saving mode");
            break;
        case Settings.Secure.LOCATION_MODE_HIGH_ACCURACY:
            Log.d(TAG, "High accuracy mode");
            break;
        case Settings.Secure.LOCATION_MODE_OFF:
        default:
            Log.d(TAG, "Location access is disabled");
    }
}

QUESTIONS

如果我的设备设置为

,我可以获得lat / lng的可能方式
  1. Settings.Secure.LOCATION_MODE_OFF
  2. Settings.Secure.LOCATION_MODE_HIGH_ACCURACY
  3. Settings.Secure.LOCATION_MODE_BATTERY_SAVING
  4. Settings.Secure.LOCATION_MODE_SENSORS_ONLY
  5. 注意:如果Settings.Secure.LOCATION_MODE_OFF我们无法获得lat / lng(我不确定)

0 个答案:

没有答案