修复不能成功绑定推送ID问题
This commit is contained in:
parent
38002914ab
commit
9c35559272
@ -55,11 +55,6 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
eventBus.fire(MineInfoChangeRefreshUI());
|
||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||
// 初始化JPush服务并绑定设备ID
|
||||
final XSJPushProvider jpushProvider = XSJPushProvider();
|
||||
await jpushProvider.initJPushService();
|
||||
await jpushProvider.bindDeviceID();
|
||||
await jpushProvider.initLocalNotification(isCancelLocalPush: false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +102,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//刷新设备信息
|
||||
void flushedDeviceInfo() {
|
||||
Future<void> flushedDeviceInfo() async {
|
||||
XSConstantMacro().getDeviceInfoData().then((Map<String, dynamic> data) {
|
||||
state.deviceInfoMap.value = data;
|
||||
}).catchError((dynamic error) {
|
||||
|
||||
@ -11,6 +11,7 @@ import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
|
||||
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import 'package:star_lock/tools/push/xs_jPhush.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../app_settings/app_settings.dart';
|
||||
@ -260,8 +261,14 @@ class LockMainLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
Future<void> onReady() async {
|
||||
super.onReady();
|
||||
// 初始化JPush服务并绑定设备ID
|
||||
final XSJPushProvider jpushProvider = XSJPushProvider();
|
||||
await jpushProvider.initJPushService();
|
||||
await jpushProvider.bindDeviceID();
|
||||
await jpushProvider.initLocalNotification(isCancelLocalPush: false);
|
||||
|
||||
// 开启UDP
|
||||
UdpHelp().openUDP();
|
||||
BlueManage();
|
||||
|
||||
@ -69,7 +69,13 @@ class XSJPushProvider {
|
||||
Future<void> bindDeviceID() async {
|
||||
try {
|
||||
AppLog.log('Fetching registration ID...');
|
||||
final String rid = await jpush.getRegistrationID();
|
||||
String rid;
|
||||
rid = await jpush.getRegistrationID();
|
||||
if (rid.isEmpty) {
|
||||
AppLog.log('Registration ID is empty.');
|
||||
rid = await jpush.getRegistrationID();
|
||||
return;
|
||||
}
|
||||
AppLog.log('flutter get registration id : $rid');
|
||||
await Storage.setString(pushDeviceID, rid);
|
||||
await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user