HuaweiPush class

华为推送服务主类

提供华为推送服务的所有功能,包括:

  • 初始化推送服务
  • 获取和管理推送Token
  • 订阅和取消订阅主题
  • 监听推送消息和事件
  • 管理通知渠道

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance HuaweiPush
获取HuaweiPush单例实例
no setter
onBadgeCountChanged Stream<int>
Badge数量变化流
no setter
onMessageClicked Stream<HuaweiPushMessage>
消息点击流
no setter
onMessageReceived Stream<HuaweiPushMessage>
推送消息接收流
no setter
onTokenRefresh Stream<HuaweiPushToken>
Token刷新流
no setter

Static Methods

clearBadge() Future<bool>
清除badge
createNotificationChannel({required String channelId, required String channelName, String? channelDescription, int? importance, bool? enableLights, bool? enableVibration, String? sound}) Future<bool>
创建通知渠道
decrementBadgeCount({int decrement = 1}) Future<int>
减少badge数量
deleteNotificationChannel(String channelId) Future<bool>
删除通知渠道
deleteToken() Future<bool>
删除推送Token
getAAID() Future<String?>
获取AAID(匿名应用标识符)
getBadgeCount() Future<int>
获取当前badge数量
getCreationTime() Future<String?>
获取创建时间
getInitialMessage() Future<HuaweiPushMessage?>
获取初始消息
getODID() Future<String?>
获取ODID(开放设备标识符)
getPlatformVersion() Future<String?>
获取平台版本
getToken() Future<String?>
获取推送Token
incrementBadgeCount({int increment = 1}) Future<int>
增加badge数量
initialize() Future<bool>
初始化华为推送服务
isAutoInitEnabled() Future<bool>
检查是否启用了自动初始化
setAutoInitEnabled(bool enabled) Future<bool>
设置自动初始化
setBadgeCount(int count) Future<bool>
设置应用图标badge数量
subscribe(String topic) Future<bool>
订阅主题
unsubscribe(String topic) Future<bool>
取消订阅主题