VoiceInteractionService.SetInvocationEffectEnabled(Boolean) 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.
Sets the enabled state for the invocation effect, a graphical indication displayed when a voice session is launched by the system.
[Android.Runtime.Register("setInvocationEffectEnabled", "(Z)V", "", ApiSince=36)]
public void SetInvocationEffectEnabled(bool enabled);
[<Android.Runtime.Register("setInvocationEffectEnabled", "(Z)V", "", ApiSince=36)>]
member this.SetInvocationEffectEnabled : bool -> unit
Parameters
- enabled
- Boolean
true to enable the invocation effect for the current user and
assistant,
false to disable it. This state is persisted by SystemUI.
- Attributes
Remarks
Sets the enabled state for the invocation effect, a graphical indication displayed when a voice session is launched by the system.
This effect is specifically triggered when a voice session is initiated via a dedicated system entry point, e.g. by long-pressing the power button to activate the current android.service.voice.VoiceInteractionService. It does not apply to voice sessions started by general Intent#ACTION_ASSIST intents from arbitrary applications.
<b>Controlling the Effect and Persistence:</b> The android.service.voice.VoiceInteractionService (the API caller) controls this setting. The choice (enabled or disabled) made through this method is persisted by SystemUI for the current user and their selected assistant. This allows the setting to be remembered across device reboots or if the same android.service.voice.VoiceInteractionService is restarted for that specific user and assistant combination.
<b>Default State and Behavior on Context Change:</b> <ul> <li>The invocation effect is <b>disabled by default</b>.</li> <li>If the current user changes, or if the selected assistant for that user changes, any previously persisted setting for a different user/assistant combination will not automatically apply to the new context.</li> <li>In such new contexts (e.g., a new user or a change in the selected assistant), or if this method has not been explicitly called to enable the effect for the current context, the effect will remain <b>disabled</b> (its default state).</li> <li>To enable the effect, or to ensure a specific state (enabled or disabled) is applied, the android.service.voice.VoiceInteractionService<b>must call this method</b>. It is strongly recommended to do so every time the service becomes active to assert the intended state for the current operational context.</li> </ul>
<b>System Conditions:</b> SystemUI will honor the state set by this method for the invocation effect, provided other system-level conditions are met, such as the correct hardware gesture for invocation (e.g., power button long-press) being detected. Note that the actual visualization of this effect is contingent on the specific SystemUI implementation; some variants, such as those on automotive or television platforms, may not have a visual representation for this effect.
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.