Get version of installed Android application
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Get version of installed Android application
Hi
I would like to log the version of the current Android application under test. I can't seem to figure out how to do it. Is it possible? I know you can get lots of application information when testing iOS, but I can't find anything similar for Android.
Best regards
Lars Lund Olsen
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lars,
To get version of the application installed on the Android device using TestComplete:
-- Get list of the installed applications with the code like this (DelphiScript):
DeviceObj := Mobile.Device(); PackManagerObj := DeviceObj.PackageManager; Num := PackManagerObj.InstalledPackageCount; for i := 0 to Num - 1 do begin Log.AppendFolder(i); PackObj := PackManagerObj.InstalledPackage(i); // Obtain the package name Log.Message('The package name is: ' + PackObj.Name); // Obtain the path to the package on the local computer Log.Message('The package local path is: ' + PackObj.PCPath); // Obtain the path to the package on the device Log.Message('The package device path is: ' + PackObj.DevicePath); if (PackManagerObj.IsActivePackage(PackObj)) then Log.Message('The specified package is active.') else Log.Message('The specified package is not active.'); Log.PopLogFolder(); end;
and get the package name from there;
-- Execute code line like this:
str := Mobile.Device.ShellExecute('dumpsys package <package_name> | grep versionName');
the above line of code should return the string like
versionName=2.0.2.11
-- Get version number from the above string.
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much! It was exactly what I was after. And thanks for pointing me to the Dumpsys command, that will be useful in other contexts as well 🙂
Best regards
Lars Lund Olsen
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great, thank you for the prompt update, Lars 🙂
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
