Skip to content

Comments

feat(app-management): add is-app-installed tool and improve list-apps#169

Merged
KazuCocoa merged 9 commits intoappium:mainfrom
Mochxd:feat/is-app-installed
Feb 21, 2026
Merged

feat(app-management): add is-app-installed tool and improve list-apps#169
KazuCocoa merged 9 commits intoappium:mainfrom
Mochxd:feat/is-app-installed

Conversation

@Mochxd
Copy link
Contributor

@Mochxd Mochxd commented Feb 16, 2026

Added appium_is_app_installed tool and fixed appium_list_apps for Android.

The new is_app_installed tool checks if an app is installed using driver methods for local sessions (iOS uses isAppInstalled(), Android uses adb.isAppInstalled()), with a fallback to the mobile: isAppInstalled command for remote sessions.

For list_apps, I fixed a bug where Android's mobile: listApps returns an array of package names but the code was expecting an object, so it was returning an empty list. Now it properly handles the array response. Also cleaned up the implementation to use driver.mobileListApps() directly instead of the ADB fallback since the driver method works fine now.

Updated the uiautomator2 driver to 6.9.0 as requested.

@KazuCocoa
Copy link
Member

fyi:
Our existing method to get app packages will cover the --user 0 case. So, after some work will simplify this implementation as well. I'll re-visit after driver side work here.
appium/appium-adb#865

packageName: s.trim(),
appName: '',
}));
if (platform === PLATFORM.android) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With updating uia2 driver with 6.9.0 in this package.json, here can be simplified with:

return await (driver as AndroidUiautomator2Driver).mobileListApps();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool i think good catch, check the new implementation 🦔​

Comment on lines 65 to 69
const result = await execute(driver, 'mobile: listApps', {});
if (result && typeof result === 'object' && !Array.isArray(result)) {
return normalizeListAppsResult(
result as Record<string, Record<string, unknown> | undefined>
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here also can be simplified with:

return await (driver as XCUITestDriver).mobileListApps();

const platform = getPlatformName(driver);
const params =
platform === PLATFORM.android ? { appId: id } : { bundleId: id };
const raw = await execute(driver, 'mobile: isAppInstalled', params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to mobileListApps, here can call:
https://github.com/appium/appium-xcuitest-driver/blob/6087bb4caa15ed5998c17f5cda1658d5fb5f32d0/lib/commands/app-management.ts#L236 for xcuitest
https://github.com/appium/appium-uiautomator2-driver/blob/5f4600593953fea521cefdb66b5bc5225ad41111/lib/uiautomator2.ts#L273 for android. So,

await (driver as XCUITestDriver).isAppInstalled(id)
await (driver as AndroidUiautomator2Driver).adb.isAppInstalled(id)

# for the `isRemoteDriverSession` case. It returns true or false.
await execute(driver, 'mobile: isAppInstalled', params);

@Mochxd Mochxd requested a review from KazuCocoa February 19, 2026 09:51
@Mochxd Mochxd requested a review from KazuCocoa February 20, 2026 22:14
Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm entirely. I left last one comment

package.json Outdated
"scripts": {
"build": "rimraf dist tsconfig.tsbuildinfo && tsc -b && chmod +x dist/index.js && npm run copy-docs",
"copy-docs": "mkdir -p dist/tools/documentation/uploads && cp -f src/tools/documentation/uploads/documents.json dist/tools/documentation/uploads/documents.json 2>/dev/null || true",
"build": "rimraf dist tsconfig.tsbuildinfo && tsc -b && node -e \"require('fs').chmodSync('dist/index.js', 0o755)\" && npm run copy-docs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last one. Could you revert these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KazuCocoa done

@Mochxd Mochxd requested a review from KazuCocoa February 21, 2026 13:07
@KazuCocoa KazuCocoa merged commit 625a364 into appium:main Feb 21, 2026
6 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 21, 2026
## [1.17.0](v1.16.1...v1.17.0) (2026-02-21)

### Features

* **app-management:** add is-app-installed tool and improve list-apps ([#169](#169)) ([625a364](625a364))
@github-actions
Copy link

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants