# BridgingManager

Artifact: [androidx.wear:wear-phone-interactions](https://developer.android.com/jetpack/androidx/releases/wear) [View Source](https://cs.android.com/search?q=file:androidx/wear/phone/interactions/notifications/BridgingManager.kt+class:androidx.wear.phone.interactions.notifications.BridgingManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***

<br />

```
public final class BridgingManager
```

<br />

*** ** * ** ***

APIs to enable/disable notification bridging at runtime.

Using a BridgingManager object, you can set a bridging mode, and optionally set tags for notifications that are exempt from the bridging mode. Specifically, create a `https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingConfig` object and set is as shown in the example usages below:

- Disable bridging at runtime:

```
BridgingManager.fromContext(context).setConfig(
    new BridgingConfig.Builder(context, false).build()
);
```

- Disable bridging at runtime except for the tags "foo" and "bar":

```
BridgingManager.fromContext(context).setConfig(
    new BridgingConfig.Builder(context, false)
        .addExcludedTag("foo")
        .addExcludedTag("bar")
        .build()
);
```

- Disable bridging at runtime except for the tags "foo" and "bar" and "baz":

```
BridgingManager.fromContext(context).setConfig(
    new BridgingConfig.Builder(context, false)
        .addExcludedTags(Arrays.asList("foo", "bar", "baz"))
        .build()
 );
```

- Adding a bridge tag to a notification posted on a phone:

```
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
// ... set other fields ...
    .extend(
        new NotificationCompat.WearableExtender()
            .setBridgeTag("foo")
     );
Notification notification = notificationBuilder.build();
```

See also:

- `https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingConfig.Builder#addExcludedTag(kotlin.String)`

- `https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingConfig.Builder#addExcludedTags(kotlin.collections.Collection)`

- `https://developer.android.com/reference/androidx/core/app/NotificationCompat.WearableExtender#setBridgeTag(java.lang.String)`

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingManager` | `https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingManager#fromContext(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Create a BridgingManager instance with the passed in Context. |
| `final void` | `https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingManager#setConfig(androidx.wear.phone.interactions.notifications.BridgingConfig)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingConfig bridgingConfig)` Sets the BridgingConfig object. |

## Public methods

### fromContext

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

```
public static final @NonNull BridgingManager fromContext(@NonNull Context context)
```

Create a BridgingManager instance with the passed in Context.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | Context object. |

### setConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

```
public final void setConfig(@NonNull BridgingConfig bridgingConfig)
```

Sets the BridgingConfig object.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/phone/interactions/notifications/BridgingConfig bridgingConfig` | The BridgingConfig object. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-runtime-exception/index.html` | if the service binding is failed. |