NotificationCompatSideChannelService.javaAPI DocAndroid 5.1 API4451Thu Mar 12 22:22:56 GMT


public abstract class NotificationCompatSideChannelService extends
Abstract service to receive side channel notifications sent from {@link}.

To receive side channel notifications, extend this service and register it in your android manifest with an intent filter for the BIND_NOTIFICATION_SIDE_CHANNEL action. Note: you must also have an enabled {@link android.service.notification.NotificationListenerService} within your package.

Example AndroidManifest.xml addition:

<service android:name="com.example.NotificationSideChannelService">
<action android:name="" />

Fields Summary
Constructors Summary
Methods Summary
public abstract voidcancel(java.lang.String packageName, int id, java.lang.String tag)
Handle a side-channelled notification being cancelled.

public abstract voidcancelAll(java.lang.String packageName)
Handle the side-channelled cancelling of all notifications for a package.

private voidcheckPermission(int callingUid, java.lang.String packageName)

        for (String validPackage : getPackageManager().getPackagesForUid(callingUid)) {
            if (validPackage.equals(packageName)) {
        throw new SecurityException("NotificationSideChannelService: Uid " + callingUid
                + " is not authorized for package " + packageName);
public abstract voidnotify(java.lang.String packageName, int id, java.lang.String tag, notification)
Handle a side-channeled notification being posted.

public android.os.IBinderonBind(android.content.Intent intent)

        if (intent.getAction().equals(NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL)) {
            // Block side channel service connections if the current sdk has no need for
            // side channeling.
            if (Build.VERSION.SDK_INT > NotificationManagerCompat.MAX_SIDE_CHANNEL_SDK_VERSION) {
                return null;
            return new NotificationSideChannelStub();
        return null;