Desired Capabilities

Capabilities tell Appium which app, device, and driver to use.

Android (UiAutomator2)

java
UiAutomator2Options options = new UiAutomator2Options()
    .setDeviceName("emulator-5554")
    .setPlatformVersion("14.0")
    .setApp("/path/to/your-app.apk")
    // OR use appPackage + appActivity for installed app:
    .setAppPackage("com.example.myapp")
    .setAppActivity(".MainActivity")
    .setNoReset(false)
    .setFullReset(false)
    .setAutomationName("UiAutomator2");

AndroidDriver driver = new AndroidDriver(
    new URL("http://localhost:4723"), options
);

iOS (XCUITest)

java
XCUITestOptions options = new XCUITestOptions()
    .setDeviceName("iPhone 15 Pro")
    .setPlatformVersion("17.4")
    .setApp("/path/to/your-app.app")
    // OR bundle ID for installed app:
    .setBundleId("com.example.myapp")
    .setNoReset(false)
    .setAutomationName("XCUITest");

IOSDriver driver = new IOSDriver(
    new URL("http://localhost:4723"), options
);