Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/content/IntentSender#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/content/IntentSender#inhconstants) \| [Fields](https://developer.android.com/reference/android/content/IntentSender#lfields) \| [Methods](https://developer.android.com/reference/android/content/IntentSender#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/IntentSender#inhmethods)

# IntentSender

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/content/IntentSender "View this page in Kotlin") \|Java


`
public


class
IntentSender
`


`

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


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

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

<br />

*** ** * ** ***

A description of an Intent and target action to perform with it.
The returned object can be
handed to other applications so that they can perform the action you
described on your behalf at a later time.

By giving a IntentSender to another application,
you are granting it the right to perform the operation you have specified
as if the other application was yourself (with the same permissions and
identity). As such, you should be careful about how you build the IntentSender:
often, for example, the base Intent you supply will have the component
name explicitly set to one of your own components, to ensure it is ultimately
sent there and nowhere else.

A IntentSender itself is simply a reference to a token maintained by
the system describing the original data used to retrieve it. This means
that, even if its owning application's process is killed, the
IntentSender itself will remain usable from other processes that
have been given it. If the creating application later re-retrieves the
same kind of IntentSender (same operation, same Intent action, data,
categories, and components, and same flags), it will receive a IntentSender
representing the same token if that is still valid.

Instances of this class can not be made directly, but rather must be
created from an existing `https://developer.android.com/reference/android/app/PendingIntent` with
`https://developer.android.com/reference/android/app/PendingIntent#getIntentSender()`.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/content/IntentSender.OnFinished` Callback interface for discovering when a send operation has completed. |
| ` class` | `https://developer.android.com/reference/android/content/IntentSender.SendIntentException` Exception thrown when trying to send through a PendingIntent that has been canceled or is otherwise no longer able to execute the request. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/content/IntentSender>` | `https://developer.android.com/reference/android/content/IntentSender#CREATOR` |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/content/IntentSender#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/content/IntentSender#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object otherObj) ` Comparison operator on two IntentSender objects, such that true is returned then they both represent the same operation from the same package. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/IntentSender#getCreatorPackage()() ` Return the package name of the application that created this IntentSender, that is the identity under which you will actually be sending the Intent. |
| ` int` | ` https://developer.android.com/reference/android/content/IntentSender#getCreatorUid()() ` Return the uid of the application that created this PendingIntent, that is the identity under which you will actually be sending the Intent. |
| ` https://developer.android.com/reference/android/os/UserHandle` | ` https://developer.android.com/reference/android/content/IntentSender#getCreatorUserHandle()() ` Return the user handle of the application that created this PendingIntent, that is the user under which you will actually be sending the Intent. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/IntentSender#getTargetPackage()() ` *This method was deprecated in API level 17. Renamed to `https://developer.android.com/reference/android/content/IntentSender#getCreatorPackage()`.* |
| ` int` | ` https://developer.android.com/reference/android/content/IntentSender#hashCode()() ` Returns a hash code value for the object. |
| ` static https://developer.android.com/reference/android/content/IntentSender` | ` https://developer.android.com/reference/android/content/IntentSender#readIntentSenderOrNullFromParcel(android.os.Parcel)(https://developer.android.com/reference/android/os/Parcel in) ` Convenience function for reading either a Messenger or `null` pointer from a Parcel. |
| ` void` | ` https://developer.android.com/reference/android/content/IntentSender#sendIntent(android.content.Context,%20int,%20android.content.Intent,%20java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.content.IntentSender.OnFinished)(https://developer.android.com/reference/android/content/Context context, int code, https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/java/lang/String requiredPermission, https://developer.android.com/reference/android/os/Bundle options, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/content/IntentSender.OnFinished onFinished) ` Perform the operation associated with this IntentSender, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| ` void` | ` https://developer.android.com/reference/android/content/IntentSender#sendIntent(android.content.Context,%20int,%20android.content.Intent,%20android.content.IntentSender.OnFinished,%20android.os.Handler)(https://developer.android.com/reference/android/content/Context context, int code, https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/content/IntentSender.OnFinished onFinished, https://developer.android.com/reference/android/os/Handler handler) ` Perform the operation associated with this IntentSender, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| ` void` | ` https://developer.android.com/reference/android/content/IntentSender#sendIntent(android.content.Context,%20int,%20android.content.Intent,%20android.content.IntentSender.OnFinished,%20android.os.Handler,%20java.lang.String)(https://developer.android.com/reference/android/content/Context context, int code, https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/content/IntentSender.OnFinished onFinished, https://developer.android.com/reference/android/os/Handler handler, https://developer.android.com/reference/java/lang/String requiredPermission) ` Perform the operation associated with this IntentSender, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/IntentSender#toString()() ` Returns a string representation of the object. |
| ` static void` | ` https://developer.android.com/reference/android/content/IntentSender#writeIntentSenderOrNullToParcel(android.content.IntentSender,%20android.os.Parcel)(https://developer.android.com/reference/android/content/IntentSender sender, https://developer.android.com/reference/android/os/Parcel out) ` Convenience function for writing either a IntentSender or `null` pointer to a Parcel. |
| ` void` | ` https://developer.android.com/reference/android/content/IntentSender#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel out, int flags) ` Flatten this object in to a Parcel. |

| ### 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*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

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

```
public static final Creator<IntentSender> CREATOR
```

<br />

<br />

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

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

```
public boolean equals (Object otherObj)
```

Comparison operator on two IntentSender objects, such that true
is returned then they both represent the same operation from the
same package.

<br />

| Parameters ||
|---|---|
| `otherObj` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getCreatorPackage

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

```
public String getCreatorPackage ()
```

Return the package name of the application that created this
IntentSender, that is the identity under which you will actually be
sending the Intent. The returned string is supplied by the system, so
that an application can not spoof its package.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The package name of the PendingIntent, or `null` if there is none associated with it. <br /> |

### getCreatorUid

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

```
public int getCreatorUid ()
```

Return the uid of the application that created this
PendingIntent, that is the identity under which you will actually be
sending the Intent. The returned integer is supplied by the system, so
that an application can not spoof its uid.

<br />

| Returns ||
|---|---|
| `int` | The uid of the PendingIntent, or -1 if there is none associated with it. <br /> |

### getCreatorUserHandle

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

```
public UserHandle getCreatorUserHandle ()
```

Return the user handle of the application that created this
PendingIntent, that is the user under which you will actually be
sending the Intent. The returned UserHandle is supplied by the system, so
that an application can not spoof its user. See
`https://developer.android.com/reference/android/os/Process#myUserHandle()` for
more explanation of user handles.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/UserHandle` | The user handle of the PendingIntent, `null` if there is none associated with it. <br /> |

### getTargetPackage

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

```
public String getTargetPackage ()
```


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

Renamed to `https://developer.android.com/reference/android/content/IntentSender#getCreatorPackage()`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### readIntentSenderOrNullFromParcel

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

```
public static IntentSender readIntentSenderOrNullFromParcel (Parcel in)
```

Convenience function for reading either a Messenger or `null` pointer from
a Parcel. You must have previously written the Messenger with
`https://developer.android.com/reference/android/content/IntentSender#writeIntentSenderOrNullToParcel(android.content.IntentSender,%20android.os.Parcel)`.

<br />

| Parameters ||
|---|---|
| `in` | `Parcel`: The Parcel containing the written Messenger. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender` | Returns the Messenger read from the Parcel, or @code null} if @code null} had been written. <br /> |

### sendIntent

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

```
public void sendIntent (Context context, 
                int code, 
                Intent intent, 
                String requiredPermission, 
                Bundle options, 
                Executor executor, 
                IntentSender.OnFinished onFinished)
```

Perform the operation associated with this IntentSender, allowing the
caller to specify information about the Intent to use and be notified
when the send has completed.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The Context of the caller. This may be `null` if <var translate="no">intent</var> is also `null`. <br /> |
| `code` | `int`: Result code to supply back to the IntentSender's target. <br /> |
| `intent` | `Intent`: Additional Intent data. See `https://developer.android.com/reference/android/content/Intent#fillIn(android.content.Intent,%20int)` for information on how this is applied to the original Intent. Use `null` to not modify the original Intent. <br /> |
| `requiredPermission` | `String`: Name of permission that a recipient of the PendingIntent is required to hold. This is only valid for broadcast intents, and corresponds to the permission argument in `https://developer.android.com/reference/android/content/Context#sendBroadcast(android.content.Intent,%20java.lang.String)`. If `null`, no permission is required. <br /> |
| `options` | `Bundle`: Additional options the caller would like to provide to modify the sending behavior. Typically built from using `https://developer.android.com/reference/android/app/ActivityOptions` to apply to an activity start. This value may be `null`. <br /> |
| `executor` | `Executor`: Executor identifying the thread on which the callback should happen. If `null`, the callback will happen from the thread pool of the process. <br /> |
| `onFinished` | `IntentSender.OnFinished`: The object to call back on when the send has completed, or `null` for no callback. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender.SendIntentException` | Throws CanceledIntentException if the IntentSender is no longer allowing more intents to be sent through it. |

### sendIntent

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

```
public void sendIntent (Context context, 
                int code, 
                Intent intent, 
                IntentSender.OnFinished onFinished, 
                Handler handler)
```

Perform the operation associated with this IntentSender, allowing the
caller to specify information about the Intent to use and be notified
when the send has completed.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The Context of the caller. This may be `null` if <var translate="no">intent</var> is also `null`. <br /> |
| `code` | `int`: Result code to supply back to the IntentSender's target. <br /> |
| `intent` | `Intent`: Additional Intent data. See `https://developer.android.com/reference/android/content/Intent#fillIn(android.content.Intent,%20int)` for information on how this is applied to the original Intent. Use `null` to not modify the original Intent. <br /> |
| `onFinished` | `IntentSender.OnFinished`: The object to call back on when the send has completed, or `null` for no callback. <br /> |
| `handler` | `Handler`: Handler identifying the thread on which the callback should happen. If `null`, the callback will happen from the thread pool of the process. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender.SendIntentException` | Throws CanceledIntentException if the IntentSender is no longer allowing more intents to be sent through it. |

### sendIntent

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

```
public void sendIntent (Context context, 
                int code, 
                Intent intent, 
                IntentSender.OnFinished onFinished, 
                Handler handler, 
                String requiredPermission)
```

Perform the operation associated with this IntentSender, allowing the
caller to specify information about the Intent to use and be notified
when the send has completed.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The Context of the caller. This may be `null` if <var translate="no">intent</var> is also `null`. <br /> |
| `code` | `int`: Result code to supply back to the IntentSender's target. <br /> |
| `intent` | `Intent`: Additional Intent data. See `https://developer.android.com/reference/android/content/Intent#fillIn(android.content.Intent,%20int)` for information on how this is applied to the original Intent. Use `null` to not modify the original Intent. <br /> |
| `onFinished` | `IntentSender.OnFinished`: The object to call back on when the send has completed, or `null` for no callback. <br /> |
| `handler` | `Handler`: Handler identifying the thread on which the callback should happen. If `null`, the callback will happen from the thread pool of the process. <br /> |
| `requiredPermission` | `String`: Name of permission that a recipient of the PendingIntent is required to hold. This is only valid for broadcast intents, and corresponds to the permission argument in `https://developer.android.com/reference/android/content/Context#sendBroadcast(android.content.Intent,%20java.lang.String)`. If `null`, no permission is required. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender.SendIntentException` | Throws CanceledIntentException if the IntentSender is no longer allowing more intents to be sent through it. |

### toString

Added in [API level 4](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 /> |

### writeIntentSenderOrNullToParcel

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

```
public static void writeIntentSenderOrNullToParcel (IntentSender sender, 
                Parcel out)
```

Convenience function for writing either a IntentSender or `null` pointer to
a Parcel. You must use this with `https://developer.android.com/reference/android/content/IntentSender#readIntentSenderOrNullFromParcel(android.os.Parcel)`
for later reading it.

<br />

| Parameters ||
|---|---|
| `sender` | `IntentSender`: The IntentSender to write, or `null`. <br /> |
| `out` | `Parcel`: Where to write the IntentSender. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `out` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |