Activity.OnGetDirectActions(CancellationSignal, IConsumer) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the list of direct actions supported by the app.
[Android.Runtime.Register("onGetDirectActions", "(Landroid/os/CancellationSignal;Ljava/util/function/Consumer;)V", "GetOnGetDirectActions_Landroid_os_CancellationSignal_Ljava_util_function_Consumer_Handler", ApiSince=29)]
public virtual void OnGetDirectActions (Android.OS.CancellationSignal cancellationSignal, Java.Util.Functions.IConsumer callback);
[<Android.Runtime.Register("onGetDirectActions", "(Landroid/os/CancellationSignal;Ljava/util/function/Consumer;)V", "GetOnGetDirectActions_Landroid_os_CancellationSignal_Ljava_util_function_Consumer_Handler", ApiSince=29)>]
abstract member OnGetDirectActions : Android.OS.CancellationSignal * Java.Util.Functions.IConsumer -> unit
override this.OnGetDirectActions : Android.OS.CancellationSignal * Java.Util.Functions.IConsumer -> unit
Parameters
- cancellationSignal
- CancellationSignal
A signal to cancel the operation in progress.
- callback
- IConsumer
The callback to send the action list. The actions list cannot
contain null
elements. You can call this on any thread.
- Attributes
Remarks
Returns the list of direct actions supported by the app.
You should return the list of actions that could be executed in the current context, which is in the current state of the app. If the actions that could be executed by the app changes you should report that via calling VoiceInteractor#notifyDirectActionsChanged()
.
To get the voice interactor you need to call #getVoiceInteractor()
which would return non null
only if there is an ongoing voice interaction session. You can also detect when the voice interactor is no longer valid because the voice interaction session that is backing is finished by calling VoiceInteractor#registerOnDestroyedCallback(Executor, Runnable)
.
This method will be called only after #onStart()
and before #onStop()
.
You should pass to the callback the currently supported direct actions which cannot be null
or contain null
elements.
You should return the action list as soon as possible to ensure the consumer, for example the assistant, is as responsive as possible which would improve user experience of your app.
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.