鸿蒙OS服务卡片:探索其基本概念与实现

harmonyos 专栏收录该内容
¥59.90 ¥99.00
122篇文章

随着鸿蒙OS的问世,服务卡片成为了其重要的特性之一。服务卡片是一种轻量级组件,可以提供特定的功能和信息,以便用户在应用程序内直接使用。在本文中,我们将详细介绍鸿蒙OS服务卡片的基本概念,并提供一些示例代码来帮助读者更好地理解和实现这一功能。

一、服务卡片的基本概念

1.1 服务卡片的定义
服务卡片是鸿蒙OS中的一个概念,用于提供特定的功能和信息,以便用户在应用程序内直接使用。它可以被视为应用程序内部的一个小型模块,具有独立的生命周期和数据传递机制。

1.2 服务卡片的特点

  • 轻量级:服务卡片是一种轻量级组件,可以在应用程序内部实现,不需要独立的应用程序。
  • 独立性:每个服务卡片都是相互独立的,可以单独开发、测试和部署。
  • 交互性:用户可以与服务卡片进行交互,获取所需的功能和信息。
  • 数据传递:服务卡片可以通过消息传递机制与应用程序进行数据交换。

1.3 服务卡片的应用场景
服务卡片可以广泛应用于各种场景,例如天气预报、新闻资讯、股票行情等。它可以为用户提供实时的信息和功能,使用户可以在应用程序内部就能满足其需求,无需切换到其他应用。

二、服务卡片的实现

2.1 服务卡片的创建
在鸿蒙OS中,我们可以通过创建一个继承自AbilitySlice的类来实现一个服务卡片。下面是一个简单的示例代码:

public class 
【鸿蒙】OpenHarmony服务卡片的用法详解 基于****FA 模型的卡片提供方开发,主要涉及如下功能逻辑:开发卡片生命周期回调函数 LifecycleForm创建卡片数据 FormBindingData 对象通过 FormProvider 更新卡片开发卡片页面基于****Stage 模型的卡片提供方开发,主要涉及如下功能逻辑:卡片生命周期回调函数 FormExtension 开发创建卡片数据 FormBindingData 对象通过 FormProvider 更新卡片卡片页面开发。 阅读详情

相关推荐

鸿蒙卡片服务

1.长按‘桌面图标’,弹出操作菜单2.点击‘服务卡片’选项,进入卡片预览界面3.点击‘添加到桌面’按钮,即可在桌面上看到新添加的卡片亮点:服务直达:将应用的重要信息以卡片形式展示在桌面,用户可以通过快捷手势使用卡片,通过轻量交互行为,实现服务直达,减少层级跳转的目的永久在线:提供定时,代理等多种卡片刷新机制,实现卡片永久在线受限管控:卡片支持的组件,事件,动效,数据管理,状态管理和API能力均进行了一定现在,保障性能,功耗及安全可靠。

qq_36197716的博客 1942

HarmonyOS Next开发学习手册——Form Kit(卡片开发服务)

Form Kit(卡片开发服务)提供一种界面展示形式,可以将应用的重要信息或操作前置到服务卡片(以下简称“卡片”),以达到服务直达、减少跳转层级的体验效果。卡片常用于嵌入到其他应用(当前被嵌入方即卡片使用方只支持系统应用,例如桌面)中作为其界面显示的一部分,并支持拉起页面、发送消息等基础的交互能力。

maniuT的博客 1964

华为鸿蒙原生应用碰一碰分享

宿主应用进入一个可以分享的界面,比如打开或者选中的一个文件、一条备忘录、一个联系人详情,或个人热点/WIFI等。宿主应用可以分享多个内容,如选中的多张图片等。手机应用发起碰一碰分享时,双端设备需要在亮屏、解锁的状态下并且都已开启华为分享服务(系统默认开启),设备顶部轻碰即可触发。如果用户已手动关闭华为分享服务开关,轻碰事件触发时,用户会接收到系统通知提示开启。

夏天的博客 3484

CMOS 半加器和全加器&&数字集成电路&& Cadence Virtuoso

数字集成电路——半加器和全加器

计科小学生的博客 1万+

BBR算法原理与实现深度解析

BBR算法通过重新定义拥塞控制的基本范式,为现代网络应用提供了突破性的解决方案。随着QUIC协议的普及和智能网卡技术的发展,BBR类算法将在边缘计算、云游戏、工业物联网等领域发挥更重要的作用。

程序猿老樊的博客 2418

从CPRI到eCPRI:手把手教你用Wireshark分析基站前传协议帧结构

本文手把手教你使用Wireshark工具,深入解析从CPRI到eCPRI的基站前传协议帧结构。通过搭建分析环境、编写解析脚本,并对比两者在时延管理、帧格式及数据封装上的差异,为无线通信领域的研发与测试人员提供了一套实用的逆向分析与故障排查方法。

x8y9z0的博客 605

电磁仿真新手必看:如何用CST Studio Suite 2023完成第一个PCB辐射仿真?

本文详细解析了如何使用CST Studio Suite 2023进行PCB辐射仿真,适合电磁仿真新手快速上手。从工程准备、求解器配置到端口设置和后处理技巧,全面覆盖三维全波电磁场仿真软件的核心操作步骤,帮助工程师精准预测和解决PCB电磁辐射问题。

y7z8a9的博客 734

comsol移动网格_comsol模拟移动的纳秒脉冲激光烧蚀材料,温度场分布,结果总不理想,求助大佬!!...

本人comsol新手一枚,希望大家多多指点研究课题:纳秒脉冲激光刻蚀材料表面想用comsol模拟刻蚀过程中的温度场分布,脉宽为300ns,重复频率100kHz,光斑移动速度为5000mm/s,光斑直径50um,激光功率10W,材料种类为:有机涂层,属性如下目前,采用的是一个移动的高斯面光源x脉冲函数,脉冲函数我用的是一个周期性方波:周期性拓展后,画出来的脉冲图,不知道为什么在0~1s的区间内只有1...

weixin_33288893的博客 4746

创客学院嵌入式驱动开发——学习资料汇总

1.创客学院知识巩固-01C语言回顾_C/C++_Set_Mode的博客-优快云博客https://blog.youkuaiyun.com/Set_Mode/article/details/94431050 2.创客学院知识巩固-02数据结构_Set_Mode的博客-优快云博客https://blog.youkuaiyun.com/Set_Mode/article/details/94431087 3.创客学院知...

snaking616 5118

PMP--二模--解题--161-170

A:邀请团队成员在下一次回顾中分享经验。B:请求发起人增加具有所需经验的团队成员。C:在团队内计划知识共享会议。D:请求发起人为团队提供培训课程。A。

stqer的博客 1270

从零搭建:C#+YOLOv8质检系统(从相机选型到上位机部署,附完整开发流程与源码)

后来换成45°斜射的条形光源,光线从侧面打在引脚上,弯曲处会形成暗区,缺陷边缘立刻清晰——光源预算别省,我这套光源+支架才600块,比换相机划算多了。前阵子帮一家电子厂做连接器引脚缺陷检测,他们原来靠2个师傅用放大镜看,每天8小时最多检5000个,0.2mm的针脚弯曲还经常漏检,不良品流到客户那里,单月罚款就超5万。做质检第一步不是挑设备,是先明确“要检测多大的缺陷”——比如我要检的连接器引脚,直径0.5mm,允许的最大弯曲是0.2mm,这直接决定相机分辨率。,后面C#就用这个模型推理。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1273

深度学习工具包 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")

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

上一篇: 「鸿蒙系统正式版手机版下载 - 鸿蒙系统正式版手机版下载 v 游戏网 HarmonyOS」
下一篇: 鸿蒙能力框架:构建高效开发的应用程序
普通网友
博客等级 码龄3年 29粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值