Condividi tramite


RemoteInput Class

Definition

A RemoteInput object specifies input to be collected from a user to be passed along with an intent inside a android.app.PendingIntent that is sent.

[Android.Runtime.Register("android/app/RemoteInput", DoNotGenerateAcw=true)]
public sealed class RemoteInput : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/RemoteInput", DoNotGenerateAcw=true)>]
type RemoteInput = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
RemoteInput
Attributes
Implements

Remarks

A RemoteInput object specifies input to be collected from a user to be passed along with an intent inside a android.app.PendingIntent that is sent. Always use RemoteInput.Builder to create instances of this class. <p class="note"> See Replying to notifications for more information on how to use this class.

The following example adds a RemoteInput to a Notification.Action, sets the result key as quick_reply, and sets the label as Quick reply. Users are prompted to input a response when they trigger the action. The results are sent along with the intent and can be retrieved with the result key (provided to the Builder constructor) from the Bundle returned by #getResultsFromIntent.

public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
            Notification.Action action = new Notification.Action.Builder(
                    R.drawable.reply, &quot;Reply&quot;, actionIntent)
<b>.addRemoteInput(new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT)
                            .setLabel("Quick reply").build()</b>)
                    .build();

When the android.app.PendingIntent is fired, the intent inside will contain the input results if collected. To access these results, use the #getResultsFromIntent function. The result values will present under the result key passed to the Builder constructor.

public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
            Bundle results = RemoteInput.getResultsFromIntent(intent);
            if (results != null) {
                CharSequence quickReplyResult = results.getCharSequence(KEY_QUICK_REPLY_TEXT);
            }

Java documentation for android.app.RemoteInput.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

EditChoicesBeforeSendingAuto
Obsolete.

The platform will determine whether choices will be edited before being sent to the app.

EditChoicesBeforeSendingDisabled
Obsolete.

Tapping on a choice should send the input immediately, without letting the user edit it.

EditChoicesBeforeSendingEnabled
Obsolete.

Tapping on a choice should let the user edit the input before it is sent to the app.

ExtraResultsData

Extra added to a clip data intent object to hold the text results bundle.

ResultsClipLabel

Label used to denote the clip data type used for remote input transport

SourceChoice
Obsolete.

The user selected one of the choices from #getChoices.

SourceFreeFormInput
Obsolete.

The user manually entered the data.

Properties

AllowedDataTypes

Get possible non-textual inputs that are accepted.

AllowFreeFormInput

Get whether or not users can provide an arbitrary value for input.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
EditChoicesBeforeSending

Gets whether tapping on a choice should let the user edit the input before it is sent to the app.

Extras

Get additional metadata carried around with this remote input.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsDataOnly

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.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Label
LabelFormatted

Get the label to display to users when collecting this input.

PeerReference (Inherited from Object)
ResultKey

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.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

AddDataResultToIntent(RemoteInput, Intent, IDictionary<String,Uri>)

Same as #addResultsToIntent but for setting data results.

AddResultsToIntent(RemoteInput[], Intent, Bundle)

Populate an intent object with the text results gathered from remote input.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

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

(Inherited from Object)
GetChoices()

Get possible input choices.

GetChoicesFormatted()

Get possible input choices.

GetDataResultsFromIntent(Intent, String)

Similar as #getResultsFromIntent but retrieves data results for a specific RemoteInput result.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetResultsFromIntent(Intent)

Get the remote input text results bundle from an intent.

GetResultsSource(Intent)

Get the source of the RemoteInput results.

JavaFinalize()

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

(Inherited from Object)
Notify()

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

(Inherited from Object)
NotifyAll()

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

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetResultsSource(Intent, RemoteInputSource)

Set the source of the RemoteInput results.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

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

(Inherited from Object)
Wait(Int64)

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

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Flatten this object in to a Parcel.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to