Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/app/StatusBarManager#constants) \| [Methods](https://developer.android.com/reference/android/app/StatusBarManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/StatusBarManager#inhmethods)

# StatusBarManager

*** ** * ** ***


`
public


class
StatusBarManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.StatusBarManager |

<br />

*** ** * ** ***

Allows an app to control the status bar.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_DISABLED` Result returned in a callback when a call to `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)` cannot be completed due to the Power Menu being currently disabled. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_SHOWING` Result returned in a callback when a call to `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)` has succeeded and the Power Menu is currently showing. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_UNKNOWN` Unknwown result of calling `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)`. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_APP_NOT_IN_FOREGROUND` Indicates that the requesting application is not in the foreground. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_BAD_COMPONENT` Indicates that the component does not match an enabled exported `https://developer.android.com/reference/android/service/quicksettings/TileService` for the current user. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_MISMATCHED_PACKAGE` Indicates that this package does not match that of the `https://developer.android.com/reference/android/service/quicksettings/TileService`. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_NOT_CURRENT_USER` Indicates that the user is not the current user. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_NO_STATUS_BAR_SERVICE` The request could not be processed because no fulfilling service was found. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_ERROR_REQUEST_IN_PROGRESS` Indicates that there's a request in progress for this package. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_RESULT_TILE_ADDED` Response indicating that the tile was added. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_RESULT_TILE_ALREADY_ADDED` Response indicating that the tile was already added and the user was not prompted. |
| `int` | `https://developer.android.com/reference/android/app/StatusBarManager#TILE_ADD_REQUEST_RESULT_TILE_NOT_ADDED` Response indicating that the tile was not added. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/app/StatusBarManager#canLaunchCaptureContentActivityForNote(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity) ` Checks whether the supplied activity can `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)` a system activity that captures content on the screen to take a screenshot. |
| ` void` | ` https://developer.android.com/reference/android/app/StatusBarManager#requestAddTileService(android.content.ComponentName,%20java.lang.CharSequence,%20android.graphics.drawable.Icon,%20java.util.concurrent.Executor,%20java.util.function.Consumer<java.lang.Integer>)(https://developer.android.com/reference/android/content/ComponentName tileServiceComponentName, https://developer.android.com/reference/java/lang/CharSequence tileLabel, https://developer.android.com/reference/android/graphics/drawable/Icon icon, https://developer.android.com/reference/java/util/concurrent/Executor resultExecutor, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Integer> resultCallback) ` Request to the user to add a `https://developer.android.com/reference/android/service/quicksettings/TileService` to the set of current QS tiles. |
| ` void` | ` https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/java/lang/Integer, https://developer.android.com/reference/java/lang/Throwable> receiver) ` Request to show the Power Menu. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### SHOW_POWER_MENU_RESULT_DISABLED

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_POWER_MENU_RESULT_DISABLED
```

Result returned in a callback when a call to `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)` cannot be completed due
to the Power Menu being currently disabled.

<br />

**See also:**

- `https://developer.android.com/reference/android/app/admin/DevicePolicyManager#LOCK_TASK_FEATURE_GLOBAL_ACTIONS`

Constant Value:

1
(0x00000001)


### SHOW_POWER_MENU_RESULT_SHOWING

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_POWER_MENU_RESULT_SHOWING
```

Result returned in a callback when a call to `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)` has succeeded and the
Power Menu is currently showing.

<br />

Constant Value:

0
(0x00000000)


### SHOW_POWER_MENU_RESULT_UNKNOWN

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_POWER_MENU_RESULT_UNKNOWN
```

Unknwown result of calling `https://developer.android.com/reference/android/app/StatusBarManager#showPowerMenu(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>)`. Used for compatibility purposes.

<br />

Constant Value:

-1
(0xffffffff)


### TILE_ADD_REQUEST_ERROR_APP_NOT_IN_FOREGROUND

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_APP_NOT_IN_FOREGROUND
```

Indicates that the requesting application is not in the foreground.

<br />

Constant Value:

1004
(0x000003ec)


### TILE_ADD_REQUEST_ERROR_BAD_COMPONENT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_BAD_COMPONENT
```

Indicates that the component does not match an enabled exported
`https://developer.android.com/reference/android/service/quicksettings/TileService` for the current user.

<br />

Constant Value:

1002
(0x000003ea)


### TILE_ADD_REQUEST_ERROR_MISMATCHED_PACKAGE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_MISMATCHED_PACKAGE
```

Indicates that this package does not match that of the
`https://developer.android.com/reference/android/service/quicksettings/TileService`.

<br />

Constant Value:

1000
(0x000003e8)


### TILE_ADD_REQUEST_ERROR_NOT_CURRENT_USER

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_NOT_CURRENT_USER
```

Indicates that the user is not the current user.

<br />

Constant Value:

1003
(0x000003eb)


### TILE_ADD_REQUEST_ERROR_NO_STATUS_BAR_SERVICE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_NO_STATUS_BAR_SERVICE
```

The request could not be processed because no fulfilling service was found. This could be
a temporary issue (for example, SystemUI has crashed).

<br />

Constant Value:

1005
(0x000003ed)


### TILE_ADD_REQUEST_ERROR_REQUEST_IN_PROGRESS

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_ERROR_REQUEST_IN_PROGRESS
```

Indicates that there's a request in progress for this package.

<br />

Constant Value:

1001
(0x000003e9)


### TILE_ADD_REQUEST_RESULT_TILE_ADDED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_RESULT_TILE_ADDED
```

Response indicating that the tile was added.

<br />

Constant Value:

2
(0x00000002)


### TILE_ADD_REQUEST_RESULT_TILE_ALREADY_ADDED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_RESULT_TILE_ALREADY_ADDED
```

Response indicating that the tile was already added and the user was not prompted.

<br />

Constant Value:

1
(0x00000001)


### TILE_ADD_REQUEST_RESULT_TILE_NOT_ADDED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TILE_ADD_REQUEST_RESULT_TILE_NOT_ADDED
```

Response indicating that the tile was not added.

<br />

Constant Value:

0
(0x00000000)


## Public methods

### canLaunchCaptureContentActivityForNote

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean canLaunchCaptureContentActivityForNote (Activity activity)
```

Checks whether the supplied activity can `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)`
a system activity that captures content on the screen to take a screenshot.

Note: The result should not be cached.

The system activity displays an editing tool that allows user to edit the screenshot, save
it on device, and return the edited screenshot as `https://developer.android.com/reference/android/net/Uri` to the calling
activity. User interaction is required to return the edited screenshot to the calling
activity.

When `true`, callers can use `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)`
to start start the content capture activity using
`https://developer.android.com/reference/android/content/Intent#ACTION_LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE`.


Requires `https://developer.android.com/reference/android/Manifest.permission#LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE`

<br />

| Parameters ||
|---|---|
| `activity` | `Activity`: Calling activity. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the activity supports launching the capture content activity for note. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/Intent#ACTION_LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE`
- `https://developer.android.com/reference/android/Manifest.permission#LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE`
- `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_NOTES`

### requestAddTileService

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestAddTileService (ComponentName tileServiceComponentName, 
                CharSequence tileLabel, 
                Icon icon, 
                Executor resultExecutor, 
                Consumer<Integer> resultCallback)
```

Request to the user to add a `https://developer.android.com/reference/android/service/quicksettings/TileService`
to the set of current QS tiles.


Calling this will prompt the user to decide whether they want to add the shown
`https://developer.android.com/reference/android/service/quicksettings/TileService` to their current tiles. The user can
deny the request and the system can stop processing requests for a given
`https://developer.android.com/reference/android/content/ComponentName` after a number of requests.


The request will show to the user information about the tile:

- Application name
- Label for the tile
- Icon for the tile


The user for which this will be added is determined from the `https://developer.android.com/reference/android/content/Context` used to retrieve
this service, and must match the current user. The requesting application must be in the
foreground (`https://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo#IMPORTANCE_FOREGROUND`
and the `https://developer.android.com/reference/android/service/quicksettings/TileService` must be exported.

Note: the system can choose to auto-deny a request if the user has denied that specific
request (user, ComponentName) enough times before.

<br />

| Parameters ||
|---|---|
| `tileServiceComponentName` | `ComponentName`: `https://developer.android.com/reference/android/content/ComponentName` of the `https://developer.android.com/reference/android/service/quicksettings/TileService` for the request. This value cannot be `null`. <br /> |
| `tileLabel` | `CharSequence`: label of the tile to show to the user. This value cannot be `null`. <br /> |
| `icon` | `Icon`: icon to use in the tile shown to the user. This value cannot be `null`. <br /> |
| `resultExecutor` | `Executor`: an executor to run the callback on. This value cannot be `null`. <br /> |
| `resultCallback` | `Consumer`: callback to indicate the result of the request. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/service/quicksettings/TileService`

### showPowerMenu

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void showPowerMenu (Executor executor, 
                OutcomeReceiver<Integer, Throwable> receiver)
```

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
`https://developer.android.com/reference/android/app/admin/DevicePolicyManager`, if `https://developer.android.com/reference/android/app/admin/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, `https://developer.android.com/reference/android/app/StatusBarManager#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 `https://developer.android.com/reference/android/os/OutcomeReceiver#onError(E)`. This error can be
`https://developer.android.com/reference/java/util/concurrent/TimeoutException` if the request times out after a few seconds
without a response, or a different `https://developer.android.com/reference/java/lang/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 `https://developer.android.com/reference/android/Manifest.permission#SHOW_POWER_MENU` or `https://developer.android.com/reference/android/Manifest.permission#SHOW_POWER_MENU_PRIVILEGED`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: an `https://developer.android.com/reference/java/util/concurrent/Executor` in which the methods of `callback` will be called. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `receiver` | `OutcomeReceiver`: will call back with the result of the request, or a possible error. This value cannot be `null`. Value is one of the following: - `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_UNKNOWN` - `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_SHOWING` - `https://developer.android.com/reference/android/app/StatusBarManager#SHOW_POWER_MENU_RESULT_DISABLED` |