Forum Discussion
I would recommend against the image-based approach, because it may be unreliable.
The recommended way to start an app is to add its .apk to TestedApps and use:
TestedApps.appname.Run()
If the app is pre-installed and you don't contol it (Calculator for example), you can run it using the "am start" shell command. You need to know the application's package name + activity name, or the intent action.
// JScript
Mobile.SetCurrent("MyDevice");
// Run Calculator Mobile.Device.ShellExecute("am start -n com.android.calculator2/.Calculator");
// Run Calendar Mobile.Device.ShellExecute("am start -n com.android.calendar/.AllInOneActivity");
// Open Settings Mobile.Device.ShellExecute("am start -n com.android.settings/.Settings");
// Run Camera Mobile.Device.ShellExecute("am start -a android.media.action.IMAGE_CAPTURE")
To find the application's activity name for use with "am start", run the app on the device, then select the device in the Object Browser and view the RunningTaskInfo.TopActivity property. The activity syntax is PackageName/ShortClassName. For example:
PackageName = com.android.calculator2
ShortClassName = .Calculator
=>
com.android.calculator2/.Calculator
For more information about the "am start" command, see Using activity manager (am) in Android developer documentation.
Thanks for your solution, Helen. Itâs a very interesting approach!
chopper_elation, you can choose between two solutions or suggest your own :)
Related Content
- 2 years ago
- 2 years ago
- 4 years ago
Recent Discussions
- 4 days ago
- 4 days ago
- 7 days ago