Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/ActivityOptions#nestedclasses) \| [Constants](https://developer.android.com/reference/android/app/ActivityOptions#constants) \| [Methods](https://developer.android.com/reference/android/app/ActivityOptions#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/ActivityOptions#inhmethods)

# ActivityOptions

*** ** * ** ***


`
public


class
ActivityOptions
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.ActivityOptions |

<br />

*** ** * ** ***

Helper class for building an options Bundle that can be used with
`https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent,%20android.os.Bundle)` and related methods.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/app/ActivityOptions.LaunchCookie` An opaque token used to track and identify a specific activity launch request. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/ActivityOptions#EXTRA_USAGE_TIME_REPORT` A long in the extras delivered by `https://developer.android.com/reference/android/app/ActivityOptions#requestUsageTimeReport(android.app.PendingIntent)` that contains the total time (in ms) the user spent in the app flow. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/ActivityOptions#EXTRA_USAGE_TIME_REPORT_PACKAGES` A Bundle in the extras delivered by `https://developer.android.com/reference/android/app/ActivityOptions#requestUsageTimeReport(android.app.PendingIntent)` that contains detailed information about the time spent in each package associated with the app; each key is a package name, whose value is a long containing the time (in ms). |
| `int` | `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` *This constant was deprecated in API level 36. Use `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` to allow starts only when the app is visible or `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` to allow starts at any time (see [Restrictions on starting activities from the background](https://developer.android.com/guide/components/activities/background-starts)).* |
| `int` | `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` Grants the `https://developer.android.com/reference/android/app/PendingIntent` all background activity start privileges, including those normally reserved for privileged contexts (e.g., companion apps or those with the `START_ACTIVITIES_FROM_BACKGROUND` permission). |
| `int` | `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` Grants the `https://developer.android.com/reference/android/app/PendingIntent` background activity start privileges only when the app has a visible window (i.e., is visible to the user). |
| `int` | `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_DENIED` Denies the `https://developer.android.com/reference/android/app/PendingIntent` any background activity start privileges. |
| `int` | `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED` The system determines whether to grant background activity start privileges. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Rect` | ` https://developer.android.com/reference/android/app/ActivityOptions#getLaunchBounds()() ` Returns the bounds that should be used to launch the activity. |
| ` https://developer.android.com/reference/android/app/ActivityOptions.LaunchCookie` | ` https://developer.android.com/reference/android/app/ActivityOptions#getLaunchCookie()() ` Gets the launch cookie associated with these options, if set. |
| ` int` | ` https://developer.android.com/reference/android/app/ActivityOptions#getLaunchDisplayId()() ` Gets the id of the display where activity should be launched. |
| ` boolean` | ` https://developer.android.com/reference/android/app/ActivityOptions#getLockTaskMode()() ` Gets whether the activity is to be launched into LockTask mode. |
| ` int` | ` https://developer.android.com/reference/android/app/ActivityOptions#getPendingIntentBackgroundActivityStartMode()() ` Get the mode for allowing or denying the senders privileges to start background activities to the PendingIntent. |
| ` int` | ` https://developer.android.com/reference/android/app/ActivityOptions#getPendingIntentCreatorBackgroundActivityStartMode()() ` Returns the mode to start background activities granted by the creator of the `https://developer.android.com/reference/android/app/PendingIntent`. |
| ` int` | ` https://developer.android.com/reference/android/app/ActivityOptions#getSplashScreenStyle()() ` Gets the style can be used for cold-launching an activity. |
| ` boolean` | ` https://developer.android.com/reference/android/app/ActivityOptions#isAllowPassThroughOnTouchOutside()() ` Returns whether the source activity allows the overlaying activities from the to-be-launched app to pass through touch events to it when touches fall outside the content window. |
| ` boolean` | ` https://developer.android.com/reference/android/app/ActivityOptions#isMovableTaskRequired()() ` Gets whether a task in which the activity will be launched is required to be movable right after launch using the `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveTaskTo(android.app.TaskLocation,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.TaskLocation,java.lang.Exception>)` method. |
| ` boolean` | ` https://developer.android.com/reference/android/app/ActivityOptions#isPendingIntentBackgroundActivityLaunchAllowed()() ` *This method was deprecated in API level 34. use `https://developer.android.com/reference/android/app/ActivityOptions#getPendingIntentBackgroundActivityStartMode()` since for apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE` or higher this value might not match the actual behavior if the value was not explicitly set.* |
| ` boolean` | ` https://developer.android.com/reference/android/app/ActivityOptions#isShareIdentityEnabled()() ` Returns whether the launching app has opted-in to sharing its identity with the launched activity. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeBasic()() ` Create a basic ActivityOptions that has no special animation associated with it. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeClipRevealAnimation(android.view.View,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/android/view/View source, int startX, int startY, int width, int height) ` Create an ActivityOptions specifying an animation where the new activity is revealed from a small originating area of the screen to its final full representation. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeCustomAnimation(android.content.Context,%20int,%20int)(https://developer.android.com/reference/android/content/Context context, int enterResId, int exitResId) ` Create an ActivityOptions specifying a custom animation to run when the activity is displayed. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeCustomAnimation(android.content.Context,%20int,%20int,%20int)(https://developer.android.com/reference/android/content/Context context, int enterResId, int exitResId, int backgroundColor) ` Create an ActivityOptions specifying a custom animation to run when the activity is displayed. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeLaunchIntoPip(android.app.PictureInPictureParams)(https://developer.android.com/reference/android/app/PictureInPictureParams pictureInPictureParams) ` Creates an `https://developer.android.com/reference/android/app/ActivityOptions` instance that launch into picture-in-picture. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeScaleUpAnimation(android.view.View,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/android/view/View source, int startX, int startY, int width, int height) ` Create an ActivityOptions specifying an animation where the new activity is scaled from a small originating area of the screen to its final full representation. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeSceneTransitionAnimation(android.app.Activity,%20android.view.View,%20java.lang.String)(https://developer.android.com/reference/android/app/Activity activity, https://developer.android.com/reference/android/view/View sharedElement, https://developer.android.com/reference/java/lang/String sharedElementName) ` Create an ActivityOptions to transition between Activities using cross-Activity scene animations. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeSceneTransitionAnimation(android.app.Activity,%20android.util.Pair<android.view.View,java.lang.String>[])(https://developer.android.com/reference/android/app/Activity activity, https://developer.android.com/reference/android/util/Pair<https://developer.android.com/reference/android/view/View, https://developer.android.com/reference/java/lang/String> sharedElements) ` Create an ActivityOptions to transition between Activities using cross-Activity scene animations. |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeTaskLaunchBehind()() ` *This method was deprecated in API level 37.2. This method is deprecated because starting an Activity behind the current task lacks transparency and violates user expectations. **Alternative:** Start the target Activity, then immediately call `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveToFront()` on the **caller's task** to restore its foreground focus.* |
| ` static https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#makeThumbnailScaleUpAnimation(android.view.View,%20android.graphics.Bitmap,%20int,%20int)(https://developer.android.com/reference/android/view/View source, https://developer.android.com/reference/android/graphics/Bitmap thumbnail, int startX, int startY) ` Create an ActivityOptions specifying an animation where a thumbnail is scaled from a given position to the new activity window that is being started. |
| ` void` | ` https://developer.android.com/reference/android/app/ActivityOptions#requestUsageTimeReport(android.app.PendingIntent)(https://developer.android.com/reference/android/app/PendingIntent receiver) ` Ask the system track that time the user spends in the app being launched, and report it back once done. |
| ` void` | ` https://developer.android.com/reference/android/app/ActivityOptions#setAllowPassThroughOnTouchOutside(boolean)(boolean allowed) ` Sets whether the source activity allows the overlaying activities from the to-be-launched app to pass through touch events to it when touches fall outside the content window. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setAppVerificationBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle bundle) ` Set the `https://developer.android.com/reference/android/os/Bundle` that is provided to the app installer for additional verification if the call to `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` results in an app being installed. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setLaunchBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect screenSpacePixelRect) ` Sets the bounds (window size and position) that the activity should be launched in. |
| ` void` | ` https://developer.android.com/reference/android/app/ActivityOptions#setLaunchCookie(android.app.ActivityOptions.LaunchCookie)(https://developer.android.com/reference/android/app/ActivityOptions.LaunchCookie launchCookie) ` Sets a launch cookie to track the `https://developer.android.com/reference/android/app/Activity` and task launched as a result of these options. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setLaunchDisplayId(int)(int launchDisplayId) ` Sets the id of the display where the activity should be launched. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setLockTaskEnabled(boolean)(boolean lockTaskMode) ` Sets whether the activity is to be launched into LockTask mode. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setMovableTaskRequired(boolean)(boolean movableTaskRequired) ` Sets whether a task in which the activity will be launched is required to be movable right after launch using the `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveTaskTo(android.app.TaskLocation,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.TaskLocation,java.lang.Exception>)` method. |
| ` void` | ` https://developer.android.com/reference/android/app/ActivityOptions#setPendingIntentBackgroundActivityLaunchAllowed(boolean)(boolean allowed) ` *This method was deprecated in API level 34. use #setPendingIntentBackgroundActivityStartMode(int) to set the full range of states* |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setPendingIntentBackgroundActivityStartMode(int)(int state) ` Sets the mode for allowing or denying the senders privileges to start background activities to the PendingIntent. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setPendingIntentCreatorBackgroundActivityStartMode(int)(int mode) ` Allow a `https://developer.android.com/reference/android/app/PendingIntent` to use the privilege of its creator to start background activities. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setShareIdentityEnabled(boolean)(boolean shareIdentity) ` Sets whether the identity of the launching app should be shared with the activity. |
| ` https://developer.android.com/reference/android/app/ActivityOptions` | ` https://developer.android.com/reference/android/app/ActivityOptions#setSplashScreenStyle(int)(int style) ` Sets the preferred splash screen style of the opening activities. |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/app/ActivityOptions#toBundle()() ` Returns the created options as a Bundle, which can be passed to `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent,%20android.os.Bundle)` and related methods. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/ActivityOptions#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/app/ActivityOptions#update(android.app.ActivityOptions)(https://developer.android.com/reference/android/app/ActivityOptions otherOptions) ` Update the current values in this ActivityOptions from those supplied in <var translate="no">otherOptions</var>. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### EXTRA_USAGE_TIME_REPORT

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_USAGE_TIME_REPORT
```

A long in the extras delivered by `https://developer.android.com/reference/android/app/ActivityOptions#requestUsageTimeReport(android.app.PendingIntent)` that contains
the total time (in ms) the user spent in the app flow.

<br />

Constant Value:

"android.activity.usage_time"


### EXTRA_USAGE_TIME_REPORT_PACKAGES

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES
```

A Bundle in the extras delivered by `https://developer.android.com/reference/android/app/ActivityOptions#requestUsageTimeReport(android.app.PendingIntent)` that contains
detailed information about the time spent in each package associated with the app;
each key is a package name, whose value is a long containing the time (in ms).

<br />

Constant Value:

"android.usage_time_packages"


### MODE_BACKGROUND_ACTIVITY_START_ALLOWED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOWED
```


**This constant was deprecated
in API level 36.**   

Use `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` to allow starts
only when the app is visible or `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` to
allow starts at any time (see [Restrictions on starting activities from the background](https://developer.android.com/guide/components/activities/background-starts)).

Grants the `https://developer.android.com/reference/android/app/PendingIntent` background activity start privileges.

This behaves the same as `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS`, except it
does not grant background activity launch permissions based on the privileged permission
`START_ACTIVITIES_FROM_BACKGROUND`.

<br />

Constant Value:

1
(0x00000001)


### MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
```

Grants the `https://developer.android.com/reference/android/app/PendingIntent` all background activity start privileges, including
those normally reserved for privileged contexts (e.g., companion apps or those with the
`START_ACTIVITIES_FROM_BACKGROUND` permission).

**Caution:** This mode should be used sparingly. Most apps should use
`https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` instead, relying on notifications
or foreground services for background interactions to minimize user disruption. However,
this mode is necessary for specific use cases, such as companion apps responding to
prompts from a connected device.

For more information on background activity start restrictions, see:
[Restrictions on starting activities from the background](https://developer.android.com/guide/components/activities/background-starts)

<br />

Constant Value:

3
(0x00000003)


### MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE
```

Grants the `https://developer.android.com/reference/android/app/PendingIntent` background activity start privileges only when the app
has a visible window (i.e., is visible to the user). This is the recommended mode for most
apps to minimize disruption to the user experience.

For more information on background activity start restrictions, see:
[Restrictions on starting activities from the background](https://developer.android.com/guide/components/activities/background-starts)

<br />

Constant Value:

4
(0x00000004)


### MODE_BACKGROUND_ACTIVITY_START_DENIED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_BACKGROUND_ACTIVITY_START_DENIED
```

Denies the `https://developer.android.com/reference/android/app/PendingIntent` any background activity start privileges.

<br />

Constant Value:

2
(0x00000002)


### MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED
```

The system determines whether to grant background activity start privileges. This is the
default behavior if no explicit mode is specified.

<br />

Constant Value:

0
(0x00000000)


## Public methods

### getLaunchBounds

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Rect getLaunchBounds ()
```

Returns the bounds that should be used to launch the activity.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Rect` | Bounds used to launch the activity. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setLaunchBounds(android.graphics.Rect)`

### getLaunchCookie

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public ActivityOptions.LaunchCookie getLaunchCookie ()
```

Gets the launch cookie associated with these options, if set.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions.LaunchCookie` | The launch tracking cookie if set, or `null` otherwise. <br /> |

### getLaunchDisplayId

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getLaunchDisplayId ()
```

Gets the id of the display where activity should be launched.

<br />

| Returns ||
|---|---|
| `int` | The id of the display where activity should be launched, `https://developer.android.com/reference/android/view/Display#INVALID_DISPLAY` if not set. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setLaunchDisplayId(int)`

### getLockTaskMode

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getLockTaskMode ()
```

Gets whether the activity is to be launched into LockTask mode.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the activity is to be launched into LockTask mode. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Activity#startLockTask()`
- `https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20java.lang.String[])`

### getPendingIntentBackgroundActivityStartMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPendingIntentBackgroundActivityStartMode ()
```

Get the mode for allowing or denying the senders privileges to start background activities
to the PendingIntent.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_DENIED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setPendingIntentBackgroundActivityStartMode(int)`

### getPendingIntentCreatorBackgroundActivityStartMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPendingIntentCreatorBackgroundActivityStartMode ()
```

Returns the mode to start background activities granted by the creator of the
`https://developer.android.com/reference/android/app/PendingIntent`.

<br />

| Returns ||
|---|---|
| `int` | the mode currently set. Value is one of the following: - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_DENIED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` |

### getSplashScreenStyle

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getSplashScreenStyle ()
```

Gets the style can be used for cold-launching an activity.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_SOLID_COLOR` - `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_ICON` |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setSplashScreenStyle(int)`

### isAllowPassThroughOnTouchOutside

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isAllowPassThroughOnTouchOutside ()
```

Returns whether the source activity allows the overlaying activities from the to-be-launched
app to pass through touch events to it when touches fall outside the content window.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setAllowPassThroughOnTouchOutside(boolean)`

### isMovableTaskRequired

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isMovableTaskRequired ()
```

Gets whether a task in which the activity will be launched is required to be movable right
after launch using the `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveTaskTo(android.app.TaskLocation,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.TaskLocation,java.lang.Exception>)` method.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setMovableTaskRequired(boolean)`

### isPendingIntentBackgroundActivityLaunchAllowed

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isPendingIntentBackgroundActivityLaunchAllowed ()
```


**This method was deprecated
in API level 34.**   

use `https://developer.android.com/reference/android/app/ActivityOptions#getPendingIntentBackgroundActivityStartMode()` since for apps
targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE` or higher this value might
not match the actual behavior if the value was not explicitly set.

Get PendingIntent activity is allowed to be started in the background if the caller can start
background activities.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isShareIdentityEnabled

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isShareIdentityEnabled ()
```

Returns whether the launching app has opted-in to sharing its identity with the launched
activity.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the launching app has opted-in to sharing its identity <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityOptions#setShareIdentityEnabled(boolean)`
- `https://developer.android.com/reference/android/app/Activity#getLaunchedFromUid()`
- `https://developer.android.com/reference/android/app/Activity#getLaunchedFromPackage()`

### makeBasic

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeBasic ()
```

Create a basic ActivityOptions that has no special animation associated with it.
Other options can still be set.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | <br /> |

### makeClipRevealAnimation

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeClipRevealAnimation (View source, 
                int startX, 
                int startY, 
                int width, 
                int height)
```

Create an ActivityOptions specifying an animation where the new
activity is revealed from a small originating area of the screen to
its final full representation.

<br />

| Parameters ||
|---|---|
| `source` | `View`: The View that the new activity is animating from. This defines the coordinate space for <var translate="no">startX</var> and <var translate="no">startY</var>. <br /> |
| `startX` | `int`: The x starting location of the new activity, relative to <var translate="no">source</var>. <br /> |
| `startY` | `int`: The y starting location of the activity, relative to <var translate="no">source</var>. <br /> |
| `width` | `int`: The initial width of the new activity. <br /> |
| `height` | `int`: The initial height of the new activity. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

### makeCustomAnimation

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeCustomAnimation (Context context, 
                int enterResId, 
                int exitResId)
```

Create an ActivityOptions specifying a custom animation to run when
the activity is displayed.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Who is defining this. This is the application that the animation resources will be loaded from. <br /> |
| `enterResId` | `int`: A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. <br /> |
| `exitResId` | `int`: A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

### makeCustomAnimation

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeCustomAnimation (Context context, 
                int enterResId, 
                int exitResId, 
                int backgroundColor)
```

Create an ActivityOptions specifying a custom animation to run when
the activity is displayed.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Who is defining this. This is the application that the animation resources will be loaded from. This value cannot be `null`. <br /> |
| `enterResId` | `int`: A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. <br /> |
| `exitResId` | `int`: A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. <br /> |
| `backgroundColor` | `int`: The background color to use for the background during the animation if the animation requires a background. Set to 0 to not override the default color. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. This value cannot be `null`. <br /> |

### makeLaunchIntoPip

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeLaunchIntoPip (PictureInPictureParams pictureInPictureParams)
```

Creates an `https://developer.android.com/reference/android/app/ActivityOptions` instance that launch into picture-in-picture.
This is normally used by a Host activity to start another activity that will directly enter
picture-in-picture upon its creation.

<br />

| Parameters ||
|---|---|
| `pictureInPictureParams` | `PictureInPictureParams`: `https://developer.android.com/reference/android/app/PictureInPictureParams` for launching the Activity to picture-in-picture mode. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | This value cannot be `null`. <br /> |

### makeScaleUpAnimation

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeScaleUpAnimation (View source, 
                int startX, 
                int startY, 
                int width, 
                int height)
```

Create an ActivityOptions specifying an animation where the new
activity is scaled from a small originating area of the screen to
its final full representation.

If the Intent this is being used with has not set its
`https://developer.android.com/reference/android/content/Intent#setSourceBounds(android.graphics.Rect)`,
those bounds will be filled in for you based on the initial
bounds passed in here.

<br />

| Parameters ||
|---|---|
| `source` | `View`: The View that the new activity is animating from. This defines the coordinate space for <var translate="no">startX</var> and <var translate="no">startY</var>. <br /> |
| `startX` | `int`: The x starting location of the new activity, relative to <var translate="no">source</var>. <br /> |
| `startY` | `int`: The y starting location of the activity, relative to <var translate="no">source</var>. <br /> |
| `width` | `int`: The initial width of the new activity. <br /> |
| `height` | `int`: The initial height of the new activity. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

### makeSceneTransitionAnimation

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeSceneTransitionAnimation (Activity activity, 
                View sharedElement, 
                String sharedElementName)
```

Create an ActivityOptions to transition between Activities using cross-Activity scene
animations. This method carries the position of one shared element to the started Activity.
The position of `sharedElement` will be used as the epicenter for the
exit Transition. The position of the shared element in the launched Activity will be the
epicenter of its entering Transition.

This requires `https://developer.android.com/reference/android/view/Window#FEATURE_ACTIVITY_TRANSITIONS` to be
enabled on the calling Activity to cause an exit transition. The same must be in
the called Activity to get an entering transition.

<br />

<br />

| Parameters ||
|---|---|
| `activity` | `Activity`: The Activity whose window contains the shared elements. <br /> |
| `sharedElement` | `View`: The View to transition to the started Activity. <br /> |
| `sharedElementName` | `String`: The shared element name as used in the target Activity. This must not be null. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

**See also:**

- `https://developer.android.com/reference/android/transition/Transition#setEpicenterCallback(android.transition.Transition.EpicenterCallback)`

### makeSceneTransitionAnimation

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeSceneTransitionAnimation (Activity activity, 
                Pair...<View, String> sharedElements)
```

Create an ActivityOptions to transition between Activities using cross-Activity scene
animations. This method carries the position of multiple shared elements to the started
Activity. The position of the first element in sharedElements
will be used as the epicenter for the exit Transition. The position of the associated
shared element in the launched Activity will be the epicenter of its entering Transition.

This requires `https://developer.android.com/reference/android/view/Window#FEATURE_ACTIVITY_TRANSITIONS` to be
enabled on the calling Activity to cause an exit transition. The same must be in
the called Activity to get an entering transition.

<br />

<br />

| Parameters ||
|---|---|
| `activity` | `Activity`: The Activity whose window contains the shared elements. <br /> |
| `sharedElements` | `Pair`: The names of the shared elements to transfer to the called Activity and their associated Views. The Views must each have a unique shared element name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

**See also:**

- `https://developer.android.com/reference/android/transition/Transition#setEpicenterCallback(android.transition.Transition.EpicenterCallback)`

### makeTaskLaunchBehind

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeTaskLaunchBehind ()
```


**This method was deprecated
in API level 37.2.**   

This method is deprecated because starting an Activity behind the current task
lacks transparency and violates user expectations. **Alternative:** Start the target
Activity, then immediately call `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveToFront()` on
the **caller's task** to restore its foreground focus.

If set along with Intent.FLAG_ACTIVITY_NEW_DOCUMENT then the task being launched will not be
presented to the user but will instead be only available through the recents task list.
In addition, the new task wil be affiliated with the launching activity's task.
Affiliated tasks are grouped together in the recents task list.

This behavior is not supported for activities with `https://developer.android.com/reference/android/R.styleable#AndroidManifestActivity_launchMode` values of
`singleInstance` or `singleTask`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | <br /> |

### makeThumbnailScaleUpAnimation

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ActivityOptions makeThumbnailScaleUpAnimation (View source, 
                Bitmap thumbnail, 
                int startX, 
                int startY)
```

Create an ActivityOptions specifying an animation where a thumbnail
is scaled from a given position to the new activity window that is
being started.

If the Intent this is being used with has not set its
`https://developer.android.com/reference/android/content/Intent#setSourceBounds(android.graphics.Rect)`,
those bounds will be filled in for you based on the initial
thumbnail location and size provided here.

<br />

| Parameters ||
|---|---|
| `source` | `View`: The View that this thumbnail is animating from. This defines the coordinate space for <var translate="no">startX</var> and <var translate="no">startY</var>. <br /> |
| `thumbnail` | `Bitmap`: The bitmap that will be shown as the initial thumbnail of the animation. <br /> |
| `startX` | `int`: The x starting location of the bitmap, relative to <var translate="no">source</var>. <br /> |
| `startY` | `int`: The y starting location of the bitmap, relative to <var translate="no">source</var>. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. <br /> |

### requestUsageTimeReport

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestUsageTimeReport (PendingIntent receiver)
```

Ask the system track that time the user spends in the app being launched, and
report it back once done. The report will be sent to the given receiver, with
the extras `https://developer.android.com/reference/android/app/ActivityOptions#EXTRA_USAGE_TIME_REPORT` and `https://developer.android.com/reference/android/app/ActivityOptions#EXTRA_USAGE_TIME_REPORT_PACKAGES`
filled in.

The time interval tracked is from launching this activity until the user leaves
that activity's flow. They are considered to stay in the flow as long as
new activities are being launched or returned to from the original flow,
even if this crosses package or task boundaries. For example, if the originator
starts an activity to view an image, and while there the user selects to share,
which launches their email app in a new task, and they complete the share, the
time during that entire operation will be included until they finally hit back from
the original image viewer activity.

The user is considered to complete a flow once they switch to another
activity that is not part of the tracked flow. This may happen, for example, by
using the notification shade, launcher, or recents to launch or switch to another
app. Simply going in to these navigation elements does not break the flow (although
the launcher and recents stops time tracking of the session); it is the act of
going somewhere else that completes the tracking.

<br />

<br />

| Parameters ||
|---|---|
| `receiver` | `PendingIntent`: A broadcast receiver that willl receive the report. <br /> |

### setAllowPassThroughOnTouchOutside

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setAllowPassThroughOnTouchOutside (boolean allowed)
```

Sets whether the source activity allows the overlaying activities from the to-be-launched
app to pass through touch events to it when touches fall outside the content window.

By default, touches that fall on a translucent non-touchable area of an overlaying
activity window may be blocked from passing through to the activity below (source activity),
unless the overlaying activity is from the same UID as the source activity. The source
activity may use this method to opt in and allow the overlaying activities from the
to-be-launched app to pass through touches to itself. The source activity needs to ensure
that it trusts the overlaying activity and its content is not vulnerable to UI redressing
attacks. The flag is ignored if the context calling
`https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent,%20android.os.Bundle)` is not an activity.

Apps with target SDK 36 and above that depend on cross-uid pass-through touches must
opt in to ensure that pass-through touches work correctly.

For backward compatibility, apps with target SDK 35 and below may still receive
pass-through touches without opt-in if the cross-uid activity is launched by the source
activity.

<br />

| Parameters ||
|---|---|
| `allowed` | `boolean` <br /> |

### setAppVerificationBundle

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setAppVerificationBundle (Bundle bundle)
```

Set the `https://developer.android.com/reference/android/os/Bundle` that is provided to the app installer for additional verification
if the call to `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` results in an app being installed.

This Bundle is not provided to any other app besides the installer.

<br />

| Parameters ||
|---|---|
| `bundle` | `Bundle` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | <br /> |

### setLaunchBounds

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setLaunchBounds (Rect screenSpacePixelRect)
```

Sets the bounds (window size and position) that the activity should be launched in.
Rect position should be provided in pixels and in screen coordinates.


**NOTE:** This value is ignored on devices that don't have
`https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT` or
`https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_PICTURE_IN_PICTURE` enabled, and on displays
that don't support freeform and PiP windows.

<br />

| Parameters ||
|---|---|
| `screenSpacePixelRect` | `Rect`: launch bounds. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | `this` `https://developer.android.com/reference/android/app/ActivityOptions` instance <br /> |

### setLaunchCookie

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setLaunchCookie (ActivityOptions.LaunchCookie launchCookie)
```

Sets a launch cookie to track the `https://developer.android.com/reference/android/app/Activity` and task launched as a result of
these options.

If the launched activity is a trampoline that starts another activity immediately,
the cookie will be transferred to the next activity.

<br />

| Parameters ||
|---|---|
| `launchCookie` | `ActivityOptions.LaunchCookie`: the unique cookie to associate with this launch, or `null` to clear <br /> |

### setLaunchDisplayId

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setLaunchDisplayId (int launchDisplayId)
```

Sets the id of the display where the activity should be launched.
An app can launch activities on public displays or displays where the app already has
activities. Otherwise, trying to launch on a display for which
`https://developer.android.com/reference/android/app/ActivityManager#isActivityStartAllowedOnDisplay(android.content.Context,%20int,%20android.content.Intent)`
returns `false` (such as a private display or providing an invalid display id) will
result in an exception.


Setting launch display id will be ignored on devices that don't have
`https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS`.

<br />

| Parameters ||
|---|---|
| `launchDisplayId` | `int`: The id of the display where the activity should be launched. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | `this` `https://developer.android.com/reference/android/app/ActivityOptions` instance. <br /> |

### setLockTaskEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setLockTaskEnabled (boolean lockTaskMode)
```

Sets whether the activity is to be launched into LockTask mode.

Use this option to start an activity in LockTask mode. Note that only apps permitted by
`https://developer.android.com/reference/android/app/admin/DevicePolicyManager` can run in LockTask mode. Therefore, if
`https://developer.android.com/reference/android/app/admin/DevicePolicyManager#isLockTaskPermitted(java.lang.String)` returns
`false` for the package of the target activity, a `https://developer.android.com/reference/java/lang/SecurityException` will be
thrown during `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent,%20android.os.Bundle)`. This method doesn't affect
activities that are already running \\u2014 relaunch the activity to run in lock task mode.

Defaults to `false` if not set.

<br />

| Parameters ||
|---|---|
| `lockTaskMode` | `boolean`: `true` if the activity is to be launched into LockTask mode. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | `this` `https://developer.android.com/reference/android/app/ActivityOptions` instance. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Activity#startLockTask()`
- `https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setLockTaskPackages(android.content.ComponentName,%20java.lang.String[])`

### setMovableTaskRequired

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setMovableTaskRequired (boolean movableTaskRequired)
```

Sets whether a task in which the activity will be launched is required to be movable right
after launch using the `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveTaskTo(android.app.TaskLocation,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.TaskLocation,java.lang.Exception>)` method. If the system cannot
guarantee this, the `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` call will throw an `https://developer.android.com/reference/android/app/InfeasibleActivityOptionsException`.

Defaults to `false`, if not set.

This option will cause the `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` call to throw an `https://developer.android.com/reference/android/app/InfeasibleActivityOptionsException` if the activity is not launched in a new task. For more
information about how the host task of a new activity is determined, see the [guide
on task management](https://developer.android.com/guide/components/activities/tasks-and-back-stack#ManagingTasks).


Requires `https://developer.android.com/reference/android/Manifest.permission#REPOSITION_SELF_WINDOWS`

<br />

| Parameters ||
|---|---|
| `movableTaskRequired` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityManager.AppTask#moveTaskTo(android.app.TaskLocation,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.TaskLocation,java.lang.Exception>)`

### setPendingIntentBackgroundActivityLaunchAllowed

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setPendingIntentBackgroundActivityLaunchAllowed (boolean allowed)
```


**This method was deprecated
in API level 34.**   

use #setPendingIntentBackgroundActivityStartMode(int) to set the full range
of states

Set PendingIntent activity is allowed to be started in the background if the caller
can start background activities.

<br />

| Parameters ||
|---|---|
| `allowed` | `boolean` <br /> |

### setPendingIntentBackgroundActivityStartMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setPendingIntentBackgroundActivityStartMode (int state)
```

Sets the mode for allowing or denying the senders privileges to start background activities
to the PendingIntent.

This is typically used in when executing `https://developer.android.com/reference/android/app/PendingIntent#send(android.content.Context,%20int,%20android.content.Intent,%20android.app.PendingIntent.OnFinished,%20android.os.Handler,%20java.lang.String,%20android.os.Bundle)` or similar
methods. A privileged sender of a PendingIntent should only grant
`https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` if the PendingIntent is from a trusted source
and/or executed on behalf the user.

<br />

| Parameters ||
|---|---|
| `state` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_DENIED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | This value cannot be `null`. <br /> |

### setPendingIntentCreatorBackgroundActivityStartMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setPendingIntentCreatorBackgroundActivityStartMode (int mode)
```

Allow a `https://developer.android.com/reference/android/app/PendingIntent` to use the privilege of its creator to start background
activities.

<br />

| Parameters ||
|---|---|
| `mode` | `int`: the mode being set. Value is one of the following: - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOWED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_DENIED` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS` - `https://developer.android.com/reference/android/app/ActivityOptions#MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | This value cannot be `null`. <br /> |

### setShareIdentityEnabled

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setShareIdentityEnabled (boolean shareIdentity)
```

Sets whether the identity of the launching app should be shared with the activity.

Use this option when starting an activity that needs to know the identity of the
launching app; with this set to `true`, the activity will have access to the launching
app's package name and uid.

Defaults to `false` if not set.

Note, even if the launching app does not explicitly enable sharing of its identity, if
the activity is started with `Activity#startActivityForResult`, then `https://developer.android.com/reference/android/app/Activity#getCallingPackage()` will still return the launching app's package name to
allow validation of the result's recipient. Also, an activity running within a package
signed by the same key used to sign the platform (some system apps such as Settings will
be signed with the platform's key) will have access to the launching app's identity.

<br />

| Parameters ||
|---|---|
| `shareIdentity` | `boolean`: whether the launching app's identity should be shared with the activity <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | `this` `https://developer.android.com/reference/android/app/ActivityOptions` instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Activity#getLaunchedFromPackage()`
- `https://developer.android.com/reference/android/app/Activity#getLaunchedFromUid()`

### setSplashScreenStyle

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ActivityOptions setSplashScreenStyle (int style)
```

Sets the preferred splash screen style of the opening activities. This only applies if the
Activity or Process is not yet created.

<br />

| Parameters ||
|---|---|
| `style` | `int`: Can be either `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_ICON` or `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_SOLID_COLOR` Value is one of the following: - `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_SOLID_COLOR` - `https://developer.android.com/reference/android/window/SplashScreen#SPLASH_SCREEN_STYLE_ICON` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ActivityOptions` | This value cannot be `null`. <br /> |

### toBundle

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bundle toBundle ()
```

Returns the created options as a Bundle, which can be passed to
`https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent,%20android.os.Bundle)` and related methods.
Note that the returned Bundle is still owned by the ActivityOptions
object; you must not modify it, but can supply it to the startActivity
methods that take an options Bundle.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | <br /> |

### toString

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### update

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void update (ActivityOptions otherOptions)
```

Update the current values in this ActivityOptions from those supplied
in <var translate="no">otherOptions</var>. Any values
defined in <var translate="no">otherOptions</var> replace those in the base options.

<br />

| Parameters ||
|---|---|
| `otherOptions` | `ActivityOptions` <br /> |