Showing
1 changed file
with
16 additions
and
5 deletions
@@ -74,11 +74,8 @@ export default class PushPluginMethodChannelHandler implements MethodCallHandler | @@ -74,11 +74,8 @@ export default class PushPluginMethodChannelHandler implements MethodCallHandler | ||
74 | notificationManager.requestEnableNotification(context).then(() => { | 74 | notificationManager.requestEnableNotification(context).then(() => { |
75 | result.success(true) | 75 | result.success(true) |
76 | }).catch((err : BusinessError) => { | 76 | }).catch((err : BusinessError) => { |
77 | - if(1600004 == err.code){ | ||
78 | - result.error(`${err.code}`,`${err.message}`,"") | ||
79 | - } else { | ||
80 | - result.error(`${err.code}`,`${err.message}`,"") | ||
81 | - } | 77 | + this.openPermissionsInSystemSettings(context, context.applicationInfo.name) |
78 | + result.success(true) | ||
82 | }); | 79 | }); |
83 | } | 80 | } |
84 | }).catch((err : BusinessError) => { | 81 | }).catch((err : BusinessError) => { |
@@ -86,6 +83,20 @@ export default class PushPluginMethodChannelHandler implements MethodCallHandler | @@ -86,6 +83,20 @@ export default class PushPluginMethodChannelHandler implements MethodCallHandler | ||
86 | }); | 83 | }); |
87 | } | 84 | } |
88 | 85 | ||
86 | + openPermissionsInSystemSettings(context: common.UIAbilityContext, bundleName: string): void { | ||
87 | + let wantInfo: Want = { | ||
88 | + bundleName: 'com.huawei.hmos.settings', | ||
89 | + abilityName: 'com.huawei.hmos.settings.MainAbility', | ||
90 | + uri: 'systemui_notification_settings', | ||
91 | + parameters: { | ||
92 | + pushParams: { | ||
93 | + bundleName: bundleName // 应用包名 | ||
94 | + } | ||
95 | + } | ||
96 | + }; | ||
97 | + context.startAbility(wantInfo); | ||
98 | + } | ||
99 | + | ||
89 | 100 | ||
90 | async init(result: MethodResult): Promise<void> { | 101 | async init(result: MethodResult): Promise<void> { |
91 | try { | 102 | try { |
-
Please register or login to post a comment