极光推送方法拆分
This commit is contained in:
parent
cd2686d1d6
commit
6db55c8e37
@ -29,22 +29,34 @@ class XSJPushProvider {
|
||||
debug: true,
|
||||
);
|
||||
|
||||
jpush.addEventHandler(
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onReceiveNotification: $message');
|
||||
},
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onOpenNotification: $message');
|
||||
},
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onReceiveMessage: $message');
|
||||
},
|
||||
);
|
||||
|
||||
jpush.applyPushAuthority(
|
||||
const NotificationSettingsIOS(sound: true, alert: true, badge: false),
|
||||
);
|
||||
|
||||
addJPushEventHandler();
|
||||
bindDeviceID();
|
||||
}
|
||||
|
||||
//极光推送事件处理方法
|
||||
void addJPushEventHandler() {
|
||||
jpush.addEventHandler(
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotification: $message');
|
||||
},
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onOpenNotification: $message');
|
||||
},
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveMessage: $message');
|
||||
},
|
||||
onReceiveNotificationAuthorization: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotificationAuthorization: $message');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//绑定设备ID
|
||||
Future<void> bindDeviceID() async {
|
||||
try {
|
||||
AppLog.log('Fetching registration ID...');
|
||||
final String rid = await jpush.getRegistrationID();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user