How to launch Android native UI settings which are not apk's example settings lockscreen etc?

How do I launch settings on the Android mobile. As this is not a native app, i assume it has no apk’s to specify app package name or activity names…

The activity name for settings depends upon the platform you are on, it could be any of the following

com.android.settings/.Settings
com.nadroid.settings/.SettingsTabActivity
com.android.settings/.GridSettings

The first is by far the most common.

1 Like

@willosser
I specified the first one ( com.android.settings/.Settings) as an app package
I then get the following exception:

(Original error: No app set; either start appium with --app or pass in an ‘app’ value in desired capabilities, or set androidPackage to launch pre-existing app on device)

    DesiredCapabilities capabilities=new DesiredCapabilities();
    capabilities.setCapability("deviceName", "Your device Name");
    capabilities.setCapability("appPackage", "com.android.settings");
    capabilities.setCapability("appActivity", ".Settings");

You can specify the app activity with name like:

capabilities.setCapability("appActivity", "com.android.settings.Settings");
1 Like

@UD

That works

Thank you :))

In android, if I’m already testing an app other than settings, how do I get to the settings without closing and reopening the driver?
With the python uiautomator, I simply called the quick_settings method and then searched for ‘settings’ and clicked that.

Any idea how to open android.settings.DATE_SETTINGS?

I can open it using adb shell, but device farm has no access to the shell so I need to to it using driver.startActivity.

The following does not work:

    val settingsActivity = Activity("com.android.settings", ".Settings\$ActionDateSettings")
    val androidDriver = driver as AndroidDriver
    androidDriver.startActivity(settingsActivity)