Most visited

Recently visited

NotificationCompatSideChannelService

public abstract class NotificationCompatSideChannelService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.support.v4.app.NotificationCompatSideChannelService


抽象服务接收 NotificationManagerCompat发送的旁道通知。

要接收旁道通知,请使用针对BIND_NOTIFICATION_SIDE_CHANNEL操作的意图过滤器来扩展此服务并将其注册到您的Android清单中。 注意:您的包装内还必须有一个启用的NotificationListenerService

示例AndroidManifest.xml添加:

 <service android:name="com.example.NotificationSideChannelService">
     <intent-filter>
         <action android:name="android.support.BIND_NOTIFICATION_SIDE_CHANNEL" />
     </intent-filter>
 </service>

Summary

Inherited constants

From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2

Public constructors

NotificationCompatSideChannelService()

Public methods

abstract void cancel(String packageName, int id, String tag)

处理旁路通知被取消。

abstract void cancelAll(String packageName)

处理包裹的所有通知的旁路取消。

abstract void notify(String packageName, int id, String tag, Notification notification)

处理发布的旁通通知。

IBinder onBind(Intent intent)

将通信信道返回给服务。

Inherited methods

From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Public constructors

NotificationCompatSideChannelService

NotificationCompatSideChannelService ()

Public methods

cancel

void cancel (String packageName, 
                int id, 
                String tag)

处理旁路通知被取消。

Parameters
packageName String
id int
tag String

cancelAll

void cancelAll (String packageName)

处理包裹的所有通知的旁路取消。

Parameters
packageName String

notify

void notify (String packageName, 
                int id, 
                String tag, 
                Notification notification)

处理发布的旁通通知。

Parameters
packageName String
id int
tag String
notification Notification

onBind

IBinder onBind (Intent intent)

将通信信道返回给服务。 如果客户端无法绑定到服务,可能会返回null。 返回IBinder通常是一个复杂的界面已经described using aidl

请注意,与其他应用程序组件不同,此处返回的IBinder接口调用可能不会发生在进程的主线程上 有关主线程的更多信息可以在Processes and Threads中找到。

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Returns
IBinder Return an IBinder through which clients can call on to the service.

Hooray!