Skip to content

Commit

Permalink
docs: add example for startActivity (#835)
Browse files Browse the repository at this point in the history
* docs: add example for startActivity

* fix review
  • Loading branch information
KazuCocoa authored Nov 9, 2024
1 parent f8ad0c6 commit 2efd7fe
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,25 @@ flags | string | no | Intent startup-specific flags as a hexadecimal string. Che

The actual stdout of the downstream `am` command.

#### Example

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.
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.

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.

```ruby
# Ruby
driver.execute_script 'mobile: startActivity', {
wait: true,
stop: true,
action: 'android.intent.action.MAIN',
component: 'io.appium.android.apis/io.appium.android.apis.ApiDemos',
categories: ['android.intent.category.LAUNCHER'],
flags: '0x10200000'
}
```

### mobile: startService

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

0 comments on commit 2efd7fe

Please sign in to comment.