做微信视频的网站平湖手机网站建设
启动本地PageAbility
PageAbility相关的能力通过featureAbility提供,启动本地Ability通过featureAbility中的startAbility接口实现。
表1 featureAbility接口说明
| 接口名 | 接口描述 | 
|---|---|
| startAbility(parameter: StartAbilityParameter) | 启动Ability。 | 
| startAbilityForResult(parameter: StartAbilityParameter) | 启动Ability,并在该Ability被销毁时返回执行结果。 | 
如下示例通过startAbility显式启动PageAbility。启动Ability的参数包含want,关于want的说明详见 对象间信息传递载体Want ,相应的,隐式启动与显式启动也不在此赘述。
import featureAbility from '@ohos.ability.featureAbility'
import Want from '@ohos.app.ability.Want';
import Logger from '../../utils/Logger';const TAG: string = 'PagePageAbilityFirst';
 
(async (): Promise<void> => {try {Logger.info(TAG, 'Begin to start ability');let want: Want = {bundleName: 'com.samples.famodelabilitydevelop',moduleName: 'entry',abilityName: 'com.samples.famodelabilitydevelop.PageAbilitySingleton'};await featureAbility.startAbility({ want: want });Logger.info(TAG, `Start ability succeed`);}catch (error) {Logger.error(TAG, 'Start ability failed with ' + error);}
})()
 
停止PageAbility
停止PageAbility通过featureAbility中的terminateSelf接口实现。
表1 featureAbility接口说明

如下示例展示了停止Ability的方法。
import featureAbility from '@ohos.ability.featureAbility';
import Logger from '../../utils/Logger';const TAG: string = 'PagePageAbilityFirst';
 
(async (): Promise<void> => {try {Logger.info(TAG, 'Begin to terminateSelf');await featureAbility.terminateSelf();Logger.info(TAG, 'terminateSelf succeed');} catch (error) {Logger.error(TAG, 'terminateSelf failed with ' + error);}
})()
 
为了能让大家更好的学习鸿蒙(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.鸿蒙南向开发方向

