I am using Appium - Java - UiAutomator2 - pCloudy combination for mobile automation . The mobile should run on specifc time zone like Australia . pCloudy is not providing any method to change it and they were saying through script timezone needs to changed . Could you please help me how i can change time zone before i trigger my app in pCloudy through appium - java code ?
I don’t think Appium can do this natively. But you can do it with ADB if you reboot the device after the change:
https://stackoverflow.com/questions/8062827/how-do-i-change-timezone-using-adb
Thank you for reply . This require rebooting device after running the ADB commands . I have not tried this option because my devices are on pCloudy .
Is there way to handle through location change like i see few command like below
driver.setLocation(new Location(49, 123, 10));
Will this change timzone according to the location given ??
Yes, I believe I mentioned device must reboot. I have not used pCloudy, very few here are experts on these device farms. I did look to see if they have support/discussion board, but I think that’s only for paying customers.
For the location change–no idea. Maybe someone else here can chime in on that issue, or you could run some tests…
Good luck!
I am running the ADB commands to change the timezone in andriod mobile .
Code :
String cmd =“setprop persist.sys.timezone “America/Chicago””;
Object obj = driver.executeScript(“pCloudy_executeAdbCommand”, cmd);
System.out.println(“ADB Command:” + cmd);
System.out.println("@Output: "+obj);
obj prints Invalid Command.
Any thing wrong in this code ?
Now i switched to Android emulator to change the timezone . I want to change the timezone in emulator device .
In the example, what’s needs to be updated to change the timezone in the emulator ?
Example :
Map<String, Object> args = new HashMap<>();
args.put(“command”, “echo”);
args.put(“args”, Lists.newArrayList(“arg1”, “arg2”));
String output = driver.executeScript(“mobile: shell”, args);
assert output.equals(“arg1 arg2”);
The commands i want pass is
setprop persist.sys.timezone “America/Chicago”
Could you please help me on this ?
Map<String, Object> args = new HashMap<>();
args.put(“command”, “echo”);
args.put(“args”, Lists.newArrayList(“setprop persist.sys.timezone”, “America/Chicago”));
Object output = driver.executeScript(“mobile: shell”, args);
is this correct statement ?