Changing io.appium.settings with java


I want to change the device Language to test the varius version of the app by selecting different languages.

the easiest way would be inserting the country and language in the capabilities

capabilities.setCapability(“locale”, “en_US”);
capabilities.setCapability(“language”, “en”);

but it is not supported in my Android device (it can’t open the settings)

another solution is the select the language wir adb

adb shell am broadcast -a io.appium.settings.locale --es lang de --es country DE

I need help to write it in a adb wrapper in JAVA.
best regards

@ghasal look at -> -> mobile:shell:
note it is required - -> --relaxed-security


List<String> arguments = Arrays.asList("-a", "io.appium.settings.locale", "--es lang", "de", "--es country",  "DE");
Map<String, Object> command = ImmutableMap.of("am", "broadcast", "args", arguments);
String outputText = (String) driver.executeScript("mobile:shell", command);