In Appium there is method to get the device time (getDeviceTime()) but there is no method to get the device timezone using Appium.
The following method is available here
commandRepository.put(GET_DEVICE_TIME, getC("/session/:sessionId/appium/device/system_time"));
We are trying using ProcessBuilder to execute the adb command but we need a common method for iOS and Android because adb supports only Android
private static String getValue(String adbCommand) throws Exception {
Process process = Runtime.getRuntime().exec(adbCommand);
StringBuilder sb = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
String data;
while ((data = br.readLine()) != null) {
sb.append(data);
}
}
return sb.toString();
}
How to get the device timezone like the device time