How to use getState method of io.appium.java_client.ios.IOSBatteryInfo class

Best io.appium code snippet using io.appium.java_client.ios.IOSBatteryInfo.getState

Run io.appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

IOSBatteryInfo.java

Source: IOSBatteryInfo.java Github

copy
1package io.appium.java_client.ios;
2
3import io.appium.java_client.battery.BatteryInfo;
4
5import java.util.Map;
6
7public class IOSBatteryInfo extends BatteryInfo {
8
9    public IOSBatteryInfo(Map<String, Object> input) {
10        super(input);
11    }
12
13    @SuppressWarnings("unchecked")
14    @Override
15    public BatteryState getState() {
16        final int state = ((Long) getInput().get("state")).intValue();
17        switch (state) {
18            case 1:
19                return BatteryState.UNPLUGGED;
20            case 2:
21                return BatteryState.CHARGING;
22            case 3:
23                return BatteryState.FULL;
24            default:
25                return BatteryState.UNKNOWN;
26        }
27    }
28
29    public enum BatteryState {
30        UNKNOWN, UNPLUGGED, CHARGING, FULL
31    }
32}
33
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in IOSBatteryInfo

Trigger getState code on LambdaTest Cloud Grid

Execute automation tests with getState on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)