【问题标题】:Checking battery saving mode in kitkat 4.4在 kitkat 4.4 中检查省电模式
【发布时间】:2014-01-06 09:35:46
【问题描述】:

Android KitKat 4.4 中有一种省电模式。它将优化 GPS 和其他功能以节省电池寿命。是否可以检查手机是否处于省电模式?

【问题讨论】:

  • 什么省电模式?您能谈谈三星特有的功能吗? Google 的股票 KitKat 没有这样的东西。
  • @ChenAsraf,AFAIK,OP 正在谈论“位置模式”设置。在那里,三个选项之一是“省电”。

标签: android battery android-4.4-kitkat battery-saver


【解决方案1】:

以下应该会有所帮助,请注意,这仅适用于 API 级别 19+:

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");
    }
}

【讨论】:

    猜你喜欢
    • 2014-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多