鸿蒙5.0开发进阶:Stage模型-@ohos.app.ability.StartOptions (StartOptions)

鸿蒙NEXT开发:Stage模型能力的接口-@ohos.app.ability.AtomicServiceOptions (AtomicServiceOptions) AtomicServiceOptions可以作为openAtomicService()的入参............ 阅读详情

往期鸿蒙全套实战文章必看:(文中附带全栈鸿蒙学习资料)


@ohos.app.ability.StartOptions (StartOptions)

StartOptions可以作为startAbility()的入参,用于指定目标Ability的窗口模式。

说明

  • 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

  • 本模块接口仅可在Stage模型下使用。

导入模块

import { StartOptions } from '@kit.AbilityKit';

属性

系统能力:SystemCapability.Ability.AbilityRuntime.Core

名称类型只读可选说明
windowMode12+number否是启动Ability时的窗口模式。
displayIdnumber否是

屏幕ID模式。默认是0,表示当前屏幕。

元服务API: 从API version 11开始,该接口支持在元服务中使用。

withAnimation11+boolean否是Ability是否具有动画效果。
windowLeft11+number否是窗口左边的位置。
windowTop11+number否是窗口顶部的位置。
windowWidth11+number否是窗口的宽度。
windowHeight11+number否是窗口的高度。
processMode12+contextConstant.ProcessMode否是

进程模式。

约束:

1.仅在平板类设备上生效。

2.仅在UIAbilityContext.startAbility中生效。

3.processMode和startupVisibility必须同时设置。

startupVisibility12+contextConstant.StartupVisibility是否

Ability启动后的可见性。

约束:

1.仅在平板类设备上生效。

2.仅在UIAbilityContext.startAbility中生效。

3.processMode和startupVisibility必须同时设置。

示例:

import { UIAbility, Want, StartOptions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';

export default class EntryAbility extends UIAbility {

  onForeground() {
    let want: Want = {
      deviceId: '',
      bundleName: 'com.example.myapplication',
      abilityName: 'EntryAbility'
    };
    let options: StartOptions = {
      displayId: 0
    };

    try {
      this.context.startAbility(want, options, (err: BusinessError) => {
        if (err.code) {
          // 处理业务逻辑错误
          console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
          return;
        }
        // 执行正常业务
        console.info('startAbility succeed');
      });
    } catch (err) {
      // 处理入参错误异常
      let code = (err as BusinessError).code;
      let message = (err as BusinessError).message;
      console.error(`startAbility failed, code is ${code}, message is ${message}`);
    }
  }
}

鸿蒙第16篇——数据持久化 本文介绍的数据持久化是指鸿蒙应用的数据持久化存储。它是将内存中的数据通过文件或数据库的形式保存到设备存储中。鸿蒙支持多种数据存储方式, 包括用户首选项Preferences、 键值型数据库KV-Store和关系型数据库。 阅读详情

相关推荐

从AMCL到SLAM Toolbox:在Nav2中实现高精度纯定位的实践指南

本文详细介绍了从AMCL迁移到SLAM Toolbox纯定位模式的实践指南,帮助开发者在Nav2中实现高精度定位。通过对比AMCL与SLAM Toolbox的性能差异,提供环境配置、参数调优、Nav2集成等关键步骤,显著提升机器人在动态环境中的定位精度和重定位效率。

weixin_29292535的博客 149

鸿蒙NEXT开发:Stage模型能力的接口-@ohos.app.ability.StartOptions (StartOptions)

StartOptions可以作为startAbility()的入参,用于指定目标Ability的窗口模式。

ZPYQAQ的博客 658

《工程测量学》笔记/期末复习资料

《工程测量学》笔记/期末复习资料。

@HNUSTer的博客 5567

HarmonyOS实战开发:@ohos.app.ability.StartOptions (StartOptions)

​ StartOptions可以作为startAbility()的入参,用于指定目标Ability的窗口模式。 ​

2401_84194030的博客 946

stc8g1k08硬件iic读取aht20温湿度及0.91寸oled显示

使用stc8g1k08读取aht20温湿度及0.91寸oled显示。

qq_61688416的博客 2772

IAR编译相同工程生产hex文件checksum不一致问题

IAR Checksum

xqw19891201的博客 1384

鸿蒙5.0开发进阶:Stage模型-@ohos.app.ability.AtomicServiceOptions (AtomicServiceOptions)

AtomicServiceOptions可以作为openAtomicService()的入参,用于携带参数。

Androidbye的博客 335

YOLO26涨点改进 | NeurIPS2025最佳论文!注意力改进篇| 引入Gated Attention门控注意力模块、太牛了!直接拯救了大模型的发展,助力目标检测、图像分割、图像分类有效涨点

本文提出了一种基于门控注意力机制(GatedAttention)的YOLO26模型改进方法。该方法在标准softmax注意力机制中引入头部特定的sigmoid门控,通过增强注意力机制使模型更聚焦于关键信息。实验表明,该模块能显著提升模型性能,特别是在复杂背景和密集目标场景中,同时减少无关区域关注并提高检测精度。门控机制引入的非线性和稀疏性不仅提升了推理效率,还改善了训练稳定性,使模型能采用更大学习率并增强扩展性。此外,该方法有效缓解了"注意力下沉"现象,增强了模型对长距离目标的感知能力。

Ai缝合怪、助力小伙伴高效发论文 658

鸿蒙API13开发【@ohos.app.ability.StartOptions (StartOptions)】Stage模型能力的接口

StartOptions可以作为[startAbility()]的入参,用于指定目标Ability的窗口模式。

鸿蒙的技术博客 506

SAP-ABAP:FI财务会计模块常用BAPI及核心用途实例说明

SAP FI模块的BAPI覆盖了从主数据管理、凭证过账到财务关账的全流程操作,是系统集成与自动化的重要工具。实际应用中需结合业务场景选择合适的BAPI,并严格遵循事务控制与校验规则。如需扩展功能,可通过BAdI或用户出口增强标准逻辑。

baidu_35680696的博客 1601

【Zephyr存储专题】06_存储块设备驱动开发(Nand Flash)

本文介绍了基于Zephyr系统的NAND Flash驱动实现方案,重点阐述了Flash驱动模型的核心架构和关键API设计。

zero的博客 1806

鸿蒙API14开发【@ohos.app.ability.StartOptions (StartOptions)】应用框架api

StartOptions可以作为[startAbility()]的入参,用于指定目标Ability的窗口模式。

bbq的博客 361

【Docker】一招解决超时镜像超时报错:`ERROR: Get https://registry-1.docker.io/v2/`

Docker 镜像拉取超时或失败并不是 Docker 本身的缺陷,而是网络环境和默认配置在特定场景下的限制所导致的结果。通过本文的分析可以看到,问题的核心往往集中在三个方面:网络访问延迟、DNS 解析速度以及客户端默认超时时间。针对这些问题,最直接、有效的做法是使用国内镜像加速器,这不仅能够显著提升拉取速度,还能保证在企业内网或家庭网络中更加稳定

博客 1030

鸿蒙API14开发【@ohos.app.ability.StartOptions (StartOptions)(系统接口)】应用框架api

StartOptions可以作为[startAbility()]的入参,用于指定目标Ability的窗口模式。

bbq的博客 248

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

鸿蒙 PC ArkUI 实战:任务看板的跨列拖放与键盘移动

桌面看板得允许人改主意:拖着卡片经过另一列,最后也可能把它放回原处。把“开始拖”和“任务状态已变”当成同一件事,会让取消操作尤其难处理。以下分别用鼠标投放和卡片上的移动入口,验证同一张任务卡怎样完成状态变更。拖动桌面看板上的任务时,松手的位置才决定任务应该去哪。如果在拖起时就从原列移除卡片,用户拖出窗口或放回原列后,还要额外处理恢复。本例用「待处理、进行中、已完成」三列展示五条模拟任务。宽窗用鼠标拖放,窄窗用标签切换列表,卡片上的移动按钮也支持键盘。

程序猿追的博客 89

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Flutter 修复 desktop_drop 鸿蒙电脑自由窗口文件拖拽:让非原点窗口准确命中并读取附件

修复鸿蒙版 desktop_drop 插件在窗口下半区拖放无响应及文件读取失败问题,通过修正坐标换算(扣除标题栏高度)与路径转换(剥离 file:// 协议头),确保文件准确交付。经双窗口复现验证,修复后可稳定接收并读取同沙箱文件,完整代码已提交至 CPF-Flutter 仓库,支持社区交流与后续维护。

白天写代码,晚上追AI大模型,偶尔搞点八卦 开源动态|技术干货|实习机会|生态活动 我负责分享,你负责变强 109

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

React Native 鸿蒙端侧 OCR 实战:TurboModule 与纯 TS 引擎的逐字契约

本文以鸿蒙真机上的 React Native 0.84 工程为例,详解三大难题:通过 TurboModule 接入 HarmonyOS Core Vision Kit 实现端侧离线 OCR;规避 Metro 预置头导致的 require 不存在问题;实现 npm 包与 HAR 双形态交付。项目采用 codegen 生成 ArkTS 接口,结合纯 TS 回退引擎,确保跨引擎逐字符一致,并通过 autolinking 支持无缝集成。

白天写代码,晚上追AI大模型,偶尔搞点八卦 开源动态|技术干货|实习机会|生态活动 我负责分享,你负责变强 115

20 嵌入式系统架构:架构模式、实时操作系统、鸿蒙案例

嵌入式架构模式怎么选、RTOS 和通用操作系统差在哪、优先级反转怎么破?本篇把前后台、中断驱动、管态目态几种结构排成一条演进线,手把手算 RMS 可调度界限、判断任务集能不能跑得动,再把优先级继承与优先级天花板两种解法对上号,配鸿蒙案例讲清工程落地。

weixin_46316564的博客 233

Flutter 修复 audio_waveforms 鸿蒙波形提取句柄与内存驻留:多段语音备忘录预览与切歌释放

修复 Flutter 鸿蒙版 audio_waveforms 库在语音备忘录连续预览与切歌时的资源泄漏问题,补全文件关闭、提取取消与播放器释放逻辑,通过两段式 Worker 停止机制与零字节 EOS 处理,实现 144 轮切换无句柄残留、内存稳定。修复版已提交至 CPF-Flutter/fluttertpc_audio_waveforms,支持鸿蒙系统高效波形提取与资源管理。

白天写代码,晚上追AI大模型,偶尔搞点八卦 开源动态|技术干货|实习机会|生态活动 我负责分享,你负责变强 32

鸿蒙 PC 桌面端应用上架实战:图匠流程图编辑器从上游 draw.io 发行包到 AGC 过审的 SIGABRT 收敛之路

鸿蒙 PC 桌面端应用上架实战:图匠流程图编辑器从上游 draw.io 发行包到 AGC 过审的 SIGABRT 收敛之路

wei_shuo的博客 1万+

RN鸿蒙空间音频实战

示例仓库:https://atomgit.com/m0_37170006/react-native-ohos-spatial-audio 社区导引:框架源码与版本发布见 https://atomgit.com/CPF-RN/ohos_react_native/tree/0.84-main CPF-RN 鸿蒙社区:https://atomgit.com/CPF-rn。

buhuisuanfa的博客 2万+

HarmonyOS PC 端适配实战:断点、分栏与键鼠交互

本文详解鸿蒙HarmonyOS在PC端的适配核心:以断点系统按窗口宽度(sm/md/lg)动态布局,结合GridRow与Navigation实现响应式分栏;重点强调键鼠交互(焦点、hover、右键、快捷键、滚轮)占七成工作量;通过交互模式抽象统一触屏与鼠标逻辑;强制声明最小窗口尺寸并自测小窗口场景;最终以“列表+详情”真实案例展示数据层一致、展示层双态的适配策略。

信息安全领域优质创作者|操作系统领域专家 244

鸿蒙沉浸光感开发适配

设备材质档位:EXQUISITE(精致,全光效,高性能设备)、GENTLE(均衡,默认)、SMOOTH(轻量,仅基础效果,低算力设备)、ADAPTIVE(自适应,系统自动识别算力选档,业务首选);用户系统设置三档(强/均衡默认/弱):本质是对透明度、反色率、折射强度的精细调控。用户的三档偏好由系统底层自动映射到渲染参数,应用只需一次定义材质,界面就会随用户设置平滑过渡,完全不需要针对三档分别写适配。

qq_63223749的博客 482

开源鸿蒙三方库适配实践:把 jsonrepair 搬到 ArkTS,端侧修好大模型吐出的坏 JSON

本文介绍了将 jsonrepair 移植至鸿蒙 ArkTS 严格模式的实践,解决大模型输出 JSON 格式错误问题。通过重构语法、优化性能,实现毫秒级修复(1MB 文本从 17.7 秒降至 127 毫秒),支持边流边修,界面实时渲染结构树。修复库已开源,提供 HAP 示范应用与完整测试验证,适用于端侧结构化输出场景。

LucianaiB的博客 837

操作系统安全体系能到哪一步?卓伊凡:服务端看认证,Ubuntu看默认,欧拉看体系,鸿蒙是另一条路

操作系统安全体系当前已实现分层保障:内核级强制访问控制(如SELinux、AppArmor)、默认攻击面收窄、密码学加密与制度化测评构成四重防线。在官方测评中,华为欧拉V3、阿里云服务器等三款系统达Ⅰ级安全可靠标准,鸿蒙桌面则首获Ⅱ级认证。Ubuntu高版本默认安全工程化出色,但加固也可能引入新漏洞。欧拉与鸿蒙技术路线不同——前者为服务端Linux加固体系,后者为终端微内核+形式化验证架构,二者可协同构建“端云安全”,但不可混为一谈。安全本质是相对的,需结合场景、运维能力与测评体系理性选型。

一颗优雅草科技-央千澈的优快云博客~只想无穷无尽的学习~作息早8-晚8 196
上一篇: 鸿蒙5.0开发进阶:Stage模型-@ohos.app.ability.ShareExtensionAbility (分享模板服务扩展能力)
下一篇: 鸿蒙5.0开发进阶:Stage模型-@ohos.app.ability.UIAbility (UIAbility)
懂你的大海
博客等级 码龄6年 9049粉丝 1381原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值