diff --git a/entry/src/main/ets/components/NotificationPublish.ets b/entry/src/main/ets/components/NotificationPublish.ets index bc9338be7e5a2166673a08ce4d94be3723e54a76..4b7e9a1edde3d90e63fdb5220d2d6320cbbeb82c 100644 --- a/entry/src/main/ets/components/NotificationPublish.ets +++ b/entry/src/main/ets/components/NotificationPublish.ets @@ -16,10 +16,12 @@ import NotificationOperations from '../feature/NotificationOperations'; import { notificationUtil } from '@ohos/notification'; import { TitleBar } from './TitleBar'; +import { common } from '@kit.AbilityKit'; @Component export struct NoticePublish { - private notificationOperations: NotificationOperations = new NotificationOperations(getContext(this)); + private context = this.getUIContext().getHostContext() as common.UIAbilityContext; + private notificationOperations: NotificationOperations = new NotificationOperations(this.context); @Styles buttonStyle(){