# App decision

A decision block that start an app activity.

The fiber will pause until the activity has finished or the timeout expired. If you don’t want the fiber to pause, use the App start block instead.

Only some app activities are designed to return a meaningful result, those activities often perform a single task, like picking, inserting or deleting content.

An app activity is referred, either explicitly by its package and activity class, e.g. by using the Pick activity button, or implicitly by an action and data URI. Explicit start is seldom needed and should be avoided as it will stop working if the activity class is renamed. To implicitly start the “main” activity like the launcher does, specify only the package.

What data, actions and extras an activity support varies. Search for public documentation, or look at the app manifest for clues. Information about common Intents.

When including a file URI either as data URI or `"android.intent.extra.STREAM"` extra, ensure to enable the appropriate Grant flags otherwise it may be inaccessible to the app.

Note! If this block cause a `ActivityNotFoundException`, `SecurityException` or otherwise fail it’s likely because the activity isn’t exported, it’s been temporarily or permanently disabled, or it’s secured by a permission to prevent third-party apps from launching it.

### Actions

The list below describe some universal or more notable actions:

- Create document — create a new empty document of MIME type, with optional title extra, in a content provider supporting it that the user picks. Must include Openable category.
- Delete — delete the given data URI from its container.
- Edit — Provide explicit editable access to the given data URI.
- Get content — let user pick a particular type of data. See Content pick block. May include Openable category.
- Insert — insert an empty item into the given container. May include data URI of the directory in which to place the data.
- Insert or edit — pick an existing item, or insert a new item, of MIME type and then edit it.
- Install package — launch application installer. Data URI must be a content or package URI where the APK can be retrieved. Not working on Android 8+ due to Google Play store policy, use workaround.
- Install package workaround — install an app package. Data URI must be a content or package URI where the APK can be retrieved. Requires Automate legacy extension on Android 8+.
- Open document — let user pick one or more existing documents of MIME type in a content provider supporting it. Must include Openable category.
- Open document tree — let user pick a directory subtree.
- Pick — let user pick an item of data. May include data URI of the directory from which to pick.
- Search — perform a search, usually with a query extra.
- Send — deliver data of MIME type to someone else, usually as a text and/or stream extra.
- Send to — send a message to recipient specified in data URI, e.g. as a mailto, sms or mms URI. See compose blocks.
- Send multiple — like send above, except the data is multiple, i.e. text and/or stream extras use `*List` conversion types.
- Translate — perform text translation of text extra.
- Uninstall package — launch application uninstaller. Data URI must be a package URI of app to uninstall.
- View — show data to the user, usually specified in Data URI. See Content view block.
- Voice command: start voice command.
- Web search — perform a web search, usually with a query extra.

### Extras

The table below lists some of the commonly used keys for the extras dictionary:

Key | Conversion type | Description
--- | --- | ---
`"android.intent.extra.HTML_TEXT"` | `String` | A HTML alternative to `"android.intent.extra.TEXT"`.
`"android.intent.extra.REFERRER"` | `Uri` | HTTP or package referrer.
`"android.intent.extra.STREAM"` | `Uri` | A data stream, e.g. a file URI.
`"android.intent.extra.SUBJECT"` | `String` | Subject of a message.
`"android.intent.extra.TEXT"` | `CharSequence` | A generic text.
`"android.intent.extra.TITLE"` | `CharSequence` | A generic title.
`"query"` | `String` | A search query.

### Launch options

Key | Conversion type | Description
--- | --- | ---
`"android:activity.animType"` | `Int` | Value as `7` will launch activity “behind”, without presenting it to user so it’s only accessible through “recents” screen, requires New document flag (Android 4.4+)
`"android:activity.launchBounds"` | `Rect` | The `[left,top,right,bottom]` bounds (window size) that the activity should be launched in (Android 7+)
`"android.activity.launchDisplayId"` | `Int` | Display id the activity should be launched into (Android 8+)
`"android:activity.lockTaskMode"` | `Boolean` | Whether the activity should be launched into “LockTask” mode (Android 9+)

## Input arguments

- Package — package name of the app activity.
- Activity class — class name of the app activity.
- Action — action the activity should perform.
- Data URI — URI for the activity to handle.
- MIME type — MIME type of data the Data URI is referring.
- Category — action category, use an array for multiple categories.
- Extras — dictionary with extended data, inconvertible entries lacking a conversion type may be excluded.
- Flags — launch flags.
- Launch options — dictionary with activity launch options. (Android 4.1+)
- Timeout — time until the notification/dialog is automatically canceled, may be inaccurate as it’s affected power save features such as “doze”, default is no timeout.
- Notification channel — UUID of notification channel used for shown notification, default is the flow default or Flow.
- Show window — whether to show the dialog window directly without having to tap the notification. Requires the “appear atop of other apps or parts of the screen” privilege on Android 10+.

## Output variables

- Result URI — variable to assign the resulting URI.
- Result extras — variable to assign a dictionary with extended result data, inconvertible entries may be excluded.