LifecycleForm接口切换
FA模型接口 | Stage模型接口对应d.ts文件 | Stage模型对应接口 |
---|---|---|
onCreate?(want: Want): formBindingData.FormBindingData; | @ohos.app.form.FormExtensionAbility.d.ts | onAddForm(want: Want): formBindingData.FormBindingData; |
onCastToNormal?(formId: string): void; | @ohos.app.form.FormExtensionAbility.d.ts | onCastToNormalForm(formId: string): void; |
onUpdate?(formId: string): void; | @ohos.app.form.FormExtensionAbility.d.ts | onUpdateForm(formId: string): void; |
onVisibilityChange?(newStatus: Record<string, number>): void; | @ohos.app.form.FormExtensionAbility.d.ts | onChangeFormVisibility(newStatus: Record<string, number>): void; |
onEvent?(formId: string, message: string): void; | @ohos.app.form.FormExtensionAbility.d.ts | onFormEvent(formId: string, message: string): void; |
onDestroy?(formId: string): void; | @ohos.app.form.FormExtensionAbility.d.ts | onRemoveForm(formId: string): void; |
onAcquireFormState?(want: Want): formInfo.FormState; | @ohos.app.form.FormExtensionAbility.d.ts | onAcquireFormState?(want: Want): formInfo.FormState; |
onShareForm?(formId: string): Record<string, Object>; | @ohos.app.form.FormExtensionAbility.d.ts | onShareForm?(formId: string): Record<string, Object>; |
LifecycleApp接口切换
FA模型接口 | Stage模型接口对应d.ts文件 | Stage模型对应接口 |
---|---|---|
onShow?(): void; | @ohos.window.d.ts | on(eventType: ‘windowStageEvent’, callback: Callback<WindowStageEventType>): void; 监听FOREGROUND切到前台状态 |
onHide?(): void; | @ohos.window.d.ts | on(eventType: ‘windowStageEvent’, callback: Callback<WindowStageEventType>): void; 监听 BACKGROUND 切到后台状态 |
onDestroy?(): void; | @ohos.app.ability.UIAbility.d.ts | onDestroy(): void; |
onCreate?(): void; | @ohos.app.ability.UIAbility.d.ts | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void; |
onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | Stage模型无对应接口 | 暂时未提供对应接口 |
onStartContinuation?(): boolean; | Stage模型无对应接口 | Stage模型上,应用无需感知迁移是否成功(由应用发起迁移请求时感知),onStartContinuation废弃 |
onSaveData?(data: Object): boolean; | @ohos.app.ability.UIAbility.d.ts | onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult; |
onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | onContinueDone(result: number): void; |
onRestoreData?(data: Object): void; | @ohos.app.ability.UIAbility.d.ts | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void; onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void; 多实例模式Ability迁移目标端在onCreate回调中完成数据恢复,单实例模式应用迁移目标端在onCreate回调中完成数据恢复,回调中通过判断launchParam.launchReason可获取迁移启动的场景,从而可以从Want中获取迁移前保存的数据 |
onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | onContinueDone(result: number): void; |
onSaveAbilityState?(outState: PacMap): void; | @ohos.app.ability.UIAbility.d.ts | onSaveState(reason: AbilityConstant.StateType, wantParam : Record<string, Object>): AbilityConstant.OnSaveResult; |
onRestoreAbilityState?(inState: PacMap): void; | @ohos.app.ability.UIAbility.d.ts | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void; 应用重启后会触发Ability的onCreate方法,通过判断launchParam.launchReason可获取自恢复的场景,从而可以从Want中获取重启前保存的数据 |
onInactive?(): void; | @ohos.app.ability.UIAbility.d.ts | onBackground(): void; |
onActive?(): void; | @ohos.app.ability.UIAbility.d.ts | onForeground(): void; |
onNewWant?(want: Want): void; | @ohos.app.ability.UIAbility.d.ts | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void; |
onMemoryLevel?(level: number): void | @ohos.app.ability.UIAbility.d.ts | onMemoryLevel(level: AbilityConstant.MemoryLevel): void; |
为了能让大家更好的学习鸿蒙(HarmonyOS NEXT)开发技术,这边特意整理了《鸿蒙开发学习手册》(共计890页),希望对大家有所帮助:https://qr21.cn/FV7h05
《鸿蒙开发学习手册》:
如何快速入门:https://qr21.cn/FV7h05
- 基本概念
- 构建第一个ArkTS应用
- ……
开发基础知识:https://qr21.cn/FV7h05
- 应用基础知识
- 配置文件
- 应用数据管理
- 应用安全管理
- 应用隐私保护
- 三方应用调用管控机制
- 资源分类与访问
- 学习ArkTS语言
- ……
基于ArkTS 开发:https://qr21.cn/FV7h05
- Ability开发
- UI开发
- 公共事件与通知
- 窗口管理
- 媒体
- 安全
- 网络与链接
- 电话服务
- 数据管理
- 后台任务(Background Task)管理
- 设备管理
- 设备使用信息统计
- DFX
- 国际化开发
- 折叠屏系列
- ……
鸿蒙开发面试真题(含参考答案):https://qr18.cn/F781PH
鸿蒙开发面试大盘集篇(共计319页):https://qr18.cn/F781PH
1.项目开发必备面试题
2.性能优化方向
3.架构方向
4.鸿蒙开发系统底层方向
5.鸿蒙音视频开发方向
6.鸿蒙车载开发方向
7.鸿蒙南向开发方向