RemoteInput
class RemoteInput
Helper for using the android.app.RemoteInput.
Summary
Nested types |
|---|
class RemoteInput.BuilderBuilder class for |
Constants |
|
|---|---|
const Int |
The platform will determine whether choices will be edited before being sent to the app. |
const Int |
Tapping on a choice should send the input immediately, without letting the user edit it. |
const Int |
Tapping on a choice should let the user edit the input before it is sent to the app. |
const String! |
EXTRA_RESULTS_DATA = "android.remoteinput.resultsData"Extra added to a clip data intent object to hold the text results bundle. |
const String! |
RESULTS_CLIP_LABEL = "android.remoteinput.results"Label used to denote the clip data type used for remote input transport |
const Int |
SOURCE_CHOICE = 1The user selected one of the choices from |
const Int |
The user manually entered the data. |
Public functions |
|
|---|---|
java-static Unit |
addDataResultToIntent(Same as |
java-static Unit |
addResultsToIntent(Populate an intent object with the results gathered from remote input. |
Boolean |
Get whether or not users can provide an arbitrary value for input. |
(Mutable)Set<String!>? |
|
Array<CharSequence!>? |
Get possible input choices. |
java-static (Mutable)Map<String!, Uri!>? |
getDataResultsFromIntent(intent: Intent, remoteInputResultKey: String)Similar as |
Int |
Gets whether tapping on a choice should let the user edit the input before it is sent to the app. |
Bundle |
Get additional metadata carried around with this remote input. |
CharSequence? |
getLabel()Get the label to display to users when collecting this input. |
String |
Get the key that the result of this input will be set in from the Bundle returned by |
java-static Bundle? |
getResultsFromIntent(intent: Intent)Get the remote input text results bundle from an intent. |
java-static Int |
getResultsSource(intent: Intent)Get the source of the RemoteInput results. |
Boolean |
Returns true if the input only accepts data, meaning |
java-static Unit |
setResultsSource(intent: Intent, source: Int)Set the source of the RemoteInput results. |
Constants
EDIT_CHOICES_BEFORE_SENDING_AUTO
const val EDIT_CHOICES_BEFORE_SENDING_AUTO = 0: Int
The platform will determine whether choices will be edited before being sent to the app.
EDIT_CHOICES_BEFORE_SENDING_DISABLED
const val EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1: Int
Tapping on a choice should send the input immediately, without letting the user edit it.
EDIT_CHOICES_BEFORE_SENDING_ENABLED
const val EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2: Int
Tapping on a choice should let the user edit the input before it is sent to the app.
EXTRA_RESULTS_DATA
const val EXTRA_RESULTS_DATA = "android.remoteinput.resultsData": String!
Extra added to a clip data intent object to hold the text results bundle.
RESULTS_CLIP_LABEL
const val RESULTS_CLIP_LABEL = "android.remoteinput.results": String!
Label used to denote the clip data type used for remote input transport
SOURCE_CHOICE
const val SOURCE_CHOICE = 1: Int
The user selected one of the choices from getChoices.
SOURCE_FREE_FORM_INPUT
const val SOURCE_FREE_FORM_INPUT = 0: Int
The user manually entered the data.
Public functions
addDataResultToIntent
java-static fun addDataResultToIntent(
remoteInput: RemoteInput,
intent: Intent,
results: (Mutable)Map<String!, Uri!>
): Unit
Same as addResultsToIntent but for setting data results.
| Parameters | |
|---|---|
remoteInput: RemoteInput |
The remote input for which results are being provided |
intent: Intent |
The intent to add remote input results to. The |
results: (Mutable)Map<String!, Uri!> |
A map of mime type to the Uri result for that mime type. |
addResultsToIntent
java-static fun addResultsToIntent(
remoteInputs: Array<RemoteInput!>,
intent: Intent,
results: Bundle
): Unit
Populate an intent object with the results gathered from remote input. This method should only be called by remote input collection services when sending results to a pending intent.
| Parameters | |
|---|---|
remoteInputs: Array<RemoteInput!> |
The remote inputs for which results are being provided |
intent: Intent |
The intent to add remote inputs to. The |
results: Bundle |
A bundle holding the remote input results. This bundle should be populated with keys matching the result keys specified in |
getAllowFreeFormInput
fun getAllowFreeFormInput(): Boolean
Get whether or not users can provide an arbitrary value for input. If you set this to false, users must select one of the choices in getChoices. An IllegalArgumentException is thrown if you set this to false and getChoices returns null or empty.
getChoices
fun getChoices(): Array<CharSequence!>?
Get possible input choices. This can be null if there are no choices to present.
getDataResultsFromIntent
java-static fun getDataResultsFromIntent(intent: Intent, remoteInputResultKey: String): (Mutable)Map<String!, Uri!>?
Similar as getResultsFromIntent but retrieves data results for a specific RemoteInput result. To retrieve a value use:
Map<String, Uri> results = RemoteInput.getDataResultsFromIntent(intent, REMOTE_INPUT_KEY); if (results != null) { Uri data = results.get(MIME_TYPE_OF_INTEREST); }
getEditChoicesBeforeSending
fun getEditChoicesBeforeSending(): Int
Gets whether tapping on a choice should let the user edit the input before it is sent to the app.
getExtras
fun getExtras(): Bundle
Get additional metadata carried around with this remote input.
getLabel
fun getLabel(): CharSequence?
Get the label to display to users when collecting this input.
getResultKey
fun getResultKey(): String
Get the key that the result of this input will be set in from the Bundle returned by getResultsFromIntent when the android.app.PendingIntent is sent.
getResultsFromIntent
java-static fun getResultsFromIntent(intent: Intent): Bundle?
Get the remote input text results bundle from an intent. The returned Bundle will contain a key/value for every result key populated by remote input collector. Use the getCharSequence method to retrieve a value. For data results use getDataResultsFromIntent.
| Parameters | |
|---|---|
intent: Intent |
The intent object that fired in response to an action or content intent which also had one or more remote input requested. |
getResultsSource
java-static fun getResultsSource(intent: Intent): Int
Get the source of the RemoteInput results.
| Parameters | |
|---|---|
intent: Intent |
The intent object that fired in response to an action or content intent which also had one or more remote input requested. |
| Returns | |
|---|---|
Int |
The source of the results. If no source was set, |
| See also | |
|---|---|
SOURCE_FREE_FORM_INPUT |
|
SOURCE_CHOICE |
isDataOnly
fun isDataOnly(): Boolean
Returns true if the input only accepts data, meaning getAllowFreeFormInput is false, getChoices is null or empty, and getAllowedDataTypes is non-null and not empty.
setResultsSource
java-static fun setResultsSource(intent: Intent, source: Int): Unit
Set the source of the RemoteInput results. This method should only be called by remote input collection services (e.g. android.service.notification.NotificationListenerService) when sending results to a pending intent.
| Parameters | |
|---|---|
intent: Intent |
The intent to add remote input source to. The |
source: Int |
The source of the results. |
| See also | |
|---|---|
SOURCE_FREE_FORM_INPUT |
|
SOURCE_CHOICE |