RemoteInputIntentHelper

public final class RemoteInputIntentHelper


Helper functions for supporting remote inputs through starting an android.content.Intent.

The following example prompts the user to provide input for one RemoteInput by starting an input activity.

public const val KEY_QUICK_REPLY_TEXT: String = "quick_reply";
val remoteInputs: List<RemoteInput> = listOf(
new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT).setLabel("Quick reply").build()
);
val intent: Intent = createActionRemoteInputIntent();
putRemoteInputsExtra(intent, remoteInputs)
startActivityForResult(intent);

The intent returned via android.app.Activity.onActivityResult will contain the input results if collected, for example:

override fun onActivityResult(requestCode: Int, resultCode: Int, intentResults: Intent?) {
val results: Bundle = RemoteInput.getResultsFromIntent(intentResults)
val quickReplyResult: CharSequence? = results.getCharSequence(KEY_QUICK_REPLY_TEXT)
}

More information about accessing these results can be found in RemoteInput.

Summary