Check whether the battery optimization settings available in the current OS version - Android Hardware

Android examples for Hardware:Battery

Description

Check whether the battery optimization settings available in the current OS version

Demo Code


//package com.java2s;

import android.os.Build;

public class Main {
    /**// w w  w .  ja  v  a 2s  . c  o  m
     * Check whether the battery optimization settings available in the current OS version
     *
     * @return
     */
    public static boolean isBatteryOptimizationSettingsAvailable() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
    }
}

Related Tutorials