FileDocCategorySizeDatePackage
NotificationCompatSideChannelService.javaAPI DocAndroid 5.1 API4451Thu Mar 12 22:22:56 GMT 2015android.support.v4.app

NotificationCompatSideChannelService

public abstract class NotificationCompatSideChannelService extends android.app.Service
Abstract service to receive side channel notifications sent from {@link android.support.v4.app.NotificationManagerCompat}.

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">
<intent-filter>
<action android:name="android.support.BIND_NOTIFICATION_SIDE_CHANNEL" />
</intent-filter>
</service>

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)) {
                return;
            }
        }
        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, android.app.Notification 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;