StatusBarManager.ShowPowerMenu(IExecutor, IOutcomeReceiver) 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.
Request to show the Power Menu.
[Android.Runtime.Register("showPowerMenu", "(Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetShowPowerMenu_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=37)]
public virtual void ShowPowerMenu(Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[<Android.Runtime.Register("showPowerMenu", "(Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetShowPowerMenu_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=37)>]
abstract member ShowPowerMenu : Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.ShowPowerMenu : Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
Parameters
- executor
- IExecutor
an Executor in which the methods of callback will be called
- receiver
- IOutcomeReceiver
will call back with the result of the request, or a possible error
- Attributes
Remarks
Request to show the Power Menu.
The Power Menu is the dialog that contains options like Power off, Restart, etc. Also known as Global Actions
Showing this dialog may be restricted by the system, for example by DevicePolicyManager, if DevicePolicyManager.LOCK_TASK_FEATURE_GLOBAL_ACTIONS is set.
The receiver will indicate when the Power Menu is visible (if possible) in its result, or whether the Power Menu is currently disabled. If the Power Menu is currently visible when the request is made, SHOW_POWER_MENU_RESULT_SHOWING will be returned through the callback immediately.
Alternatively, if the request could not be completed due to an error, it will be returned with OutcomeReceiver.onError. This error can be TimeoutException if the request times out after a few seconds without a response, or a different Exception. In these error cases, it usually means that there's an underlying issue with the system and retrying will not succeed.
This callback can be reused for multiple requests. Requires Manifest.permission.SHOW_POWER_MENU or Manifest.permission.SHOW_POWER_MENU_PRIVILEGED
Android reference for android.app.StatusBarManager.showPowerMenu.
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.