VoiceInteractionSession.SetKeepAwake(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.
Set whether this session will keep the device awake while it is running a voice activity.
[Android.Runtime.Register("setKeepAwake", "(Z)V", "GetSetKeepAwake_ZHandler", ApiSince=23)]
public virtual void SetKeepAwake (bool keepAwake);
[<Android.Runtime.Register("setKeepAwake", "(Z)V", "GetSetKeepAwake_ZHandler", ApiSince=23)>]
abstract member SetKeepAwake : bool -> unit
override this.SetKeepAwake : bool -> unit
Parameters
- keepAwake
- Boolean
- Attributes
Remarks
Set whether this session will keep the device awake while it is running a voice activity. By default, the system holds a wake lock for it while in this state, so that it can work even if the screen is off. Setting this to false removes that wake lock, allowing the CPU to go to sleep. This is typically used if the session decides it has been waiting too long for a response from the user and doesn't want to let this continue to drain the battery.
Passing false here will release the wake lock, and you can call later with true to re-acquire it. It will also be automatically re-acquired for you each time you start a new voice activity task -- that is when you call #startVoiceActivity
.
Java documentation for android.service.voice.VoiceInteractionSession.setKeepAwake(boolean)
.
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.