Skip to content

Commit 2efd7fe

Browse files
authored
docs: add example for startActivity (#835)
* docs: add example for startActivity * fix review
1 parent f8ad0c6 commit 2efd7fe

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,25 @@ flags | string | no | Intent startup-specific flags as a hexadecimal string. Che
878878

879879
The actual stdout of the downstream `am` command.
880880

881+
#### Example
882+
883+
Use the code snippet below to represent the following shell command: `shell am start-activity -W -n io.appium.android.apis/io.appium.android.apis.ApiDemos -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'`, which is usually similar to what is called in a new session request.
884+
If you replace `'io.appium.android.apis/io.appium.android.apis.ApiDemos'` with your expected launchable activity, it would be the alternative method to start the activity in session.
885+
886+
Please check [how appium adds flags](https://github.com/appium/appium-android-driver/blob/master/lib/commands/intent.js) for more details to understand how Appium builds flags.
887+
888+
```ruby
889+
# Ruby
890+
driver.execute_script 'mobile: startActivity', {
891+
wait: true,
892+
stop: true,
893+
action: 'android.intent.action.MAIN',
894+
component: 'io.appium.android.apis/io.appium.android.apis.ApiDemos',
895+
categories: ['android.intent.category.LAUNCHER'],
896+
flags: '0x10200000'
897+
}
898+
```
899+
881900
### mobile: startService
882901

883902
Starts the given service intent. Invokes `am startservice` or `am start-service` command under the hood.

0 commit comments

Comments
 (0)