文档

CustomNotificationBuilder API

更新时间:

CustomNotificationBuilder用于注册用户设定好的自定义样式通知。

获取CustomNotificationBuilder API

CustomNotificationBuilder是单例类,必须通过指定接口来获取实例。

接口定义
public static CustomNotificationBuilder getInstance();
代码示例
CustomNotificationBuilder customNotificationBuilder = CustomNotificationBuilder.getInstance();

注册自定义样式通知

用户创建好自定义样式通知后需要将其注册,并赋予其一个特定的ID。

接口定义

public  boolean setCustomNotification(int customNotificationId, BasicCustomPushNotification notification);

参数说明

参数

类型

是否必填

说明

customNotificationId

int

所注册的自定义样式通知的ID,ID必须大于0。如果将多个不同的自定义样式通知赋予同一个ID,则最后注册的通知有效,其他的通知样式将会被覆盖。

notification

BasicCustomPushNotification / AdvancedCustomPushNotification 对象

创建的通知,该通知可以是BasicCustomPushNotification对象也可以是AdvancedCustomPushNotification对象,但是不能为null。

说明

该方法会返回一个boolean类型的结果,如果返回true,则注册成功;反之则失败。

代码示例

CustomNotificationBuilder.getInstance().setCustomNotification(1, new BasicCustomPushNotification());
  • 本页导读 (0)
文档反馈