BridgingManager


public final class BridgingManager


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 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:

Summary

Public methods

static final @NonNull BridgingManager

Create a BridgingManager instance with the passed in Context.

final void
setConfig(@NonNull BridgingConfig bridgingConfig)

Sets the BridgingConfig object.

Public methods

fromContext

Added in 1.0.0
public static final @NonNull BridgingManager fromContext(@NonNull Context context)

Create a BridgingManager instance with the passed in Context.

Parameters
@NonNull Context context

Context object.

setConfig

Added in 1.0.0
public final void setConfig(@NonNull BridgingConfig bridgingConfig)

Sets the BridgingConfig object.

Parameters
@NonNull BridgingConfig bridgingConfig

The BridgingConfig object.

Throws
kotlin.RuntimeException

if the service binding is failed.