当前位置: 首页 > news >正文

快站淘客网站如何优化流程

快站淘客,网站如何优化流程,专门做外贸的网站有哪些,一流的嘉兴网站建设华为鸿蒙手表开发之动态生成二维码 前言: 最近入职新公司,由于之前的哥们临时离职,走得很突然,所以没有任何交接和文档,临时顶上公司手表应用的上架,更换了新的密钥和key之后重新测试功能和流程&#xff…

华为鸿蒙手表开发之动态生成二维码

前言:

最近入职新公司,由于之前的哥们临时离职,走得很突然,所以没有任何交接和文档,临时顶上公司手表应用的上架,更换了新的密钥和key之后重新测试功能和流程,基本上没啥大问题,华为那边的工作人员也测试通过了,但是说隐私政策页面有一点问题,内容有几个错误点,我检查了一下App中的隐私政策发现是本地写死的页面,于是询问华为的工作人员该如何修改,他们给出一个意见,用二维码生成一个页面,用户和测试人员扫码就可以加载对应的页面,而且这个url地址里面的内容是动态的,可以随意修改,不需要App频繁改动,对于后期的审核和上架基本上是一步到位,于是简单的学习了一下官方文档,百度查询了一下资料,生成了一个二维码界面。

1.新建一个隐私政策页面:

/*** @author:test* @date:2023/9/26 17:14* @description:隐私政策*/
public class PrivacyPolicyQRCodeAbility extends Ability {@Overridepublic void onStart(Intent intent) {super.onStart(intent);super.setMainRoute(PrivacyPolicyQRCodeSlice.class.getName());}
}

2.生成二维码及扫描页面:

步骤如下:

  • 初始化view: initIView()
  • 初始化二维码引擎:VisionManager.init(PrivacyPolicyQRCodeSlice.this, connectionCallback);
  • 二维码连接回调:ConnectionCallback connectionCallback = new ConnectionCallback()
  • 连接成功后生成二维码:createQRCode(qrCodeUrlTxt);
  • 在界面退出时销毁引擎:VisionManager.destroy();
package com.xxx.hwwear.slice;import com.elvishew.xlog.XLog;
import com.yadea.hwwear.BuildConfig;
import com.yadea.hwwear.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Image;
import ohos.ai.cv.common.ConnectionCallback;
import ohos.ai.cv.common.VisionManager;
import ohos.ai.cv.qrcode.IBarcodeDetector;
import ohos.media.image.ImageSource;
import ohos.media.image.PixelMap;
import ohos.media.image.common.PixelFormat;/*** @author:njb* @date:2023/9/26 17:14* @description:扫描二维码进入隐私政策页面*/
public class PrivacyPolicyQRCodeSlice extends AbilitySlice {Image codeImage;@Overridepublic void onStart(Intent intent) {super.onStart(intent);super.setUIContent(ResourceTable.Layout_ability_service_protocol_qr_code);initView();}private void initView() {codeImage = (Image) findComponentById(ResourceTable.Id_imgQrCode);}@Overridepublic void onActive() {super.onActive();VisionManager.init(PrivacyPolicyQRCodeSlice.this, connectionCallback);}@Overridepublic void onForeground(Intent intent) {super.onForeground(intent);}@Overrideprotected void onBackground() {super.onBackground();VisionManager.destroy();}ConnectionCallback connectionCallback = new ConnectionCallback() {@Overridepublic void onServiceConnect() {String qrCodeUrlTxt = "https://developer.huawei.com/consumer/cn/harmonyos";//连接成功生成二维码createQRCode(qrCodeUrlTxt);}@Overridepublic void onServiceDisconnect() {if (BuildConfig.DEBUG) {XLog.d("Vision onServiceDisconnect");}}};/*** 创建二维码** @param barText 需要生成二维码的字符串*/private void createQRCode(String barText) {//实例化接口,获取二维码侦测器IBarcodeDetector barcodeDetector = VisionManager.getBarcodeDetector(PrivacyPolicyQRCodeSlice.this);//定义码生成图像的尺寸final int SAMPLE_LENGTH = getLayoutParams().width;//根据图像的大小,分配字节流数组的空间byte[] byteArray = new byte[SAMPLE_LENGTH * SAMPLE_LENGTH * 4];//调用IBarcodeDetector的detect()方法,根据输入的字符串信息生成相应的二维码图片字节流barcodeDetector.detect(barText, byteArray, SAMPLE_LENGTH, SAMPLE_LENGTH);//释放侦测器barcodeDetector.release();//通过SourceOptions指定数据源的格式信息ImageSource.SourceOptions srcOpts = new ImageSource.SourceOptions();//定义图片格式srcOpts.formatHint = "image/png";//创建图片源ImageSource imgSource = ImageSource.create(byteArray, srcOpts);//创建图像解码选项ImageSource.DecodingOptions decodingOpts = new ImageSource.DecodingOptions();decodingOpts.desiredPixelFormat = PixelFormat.ARGB_8888;//通过图片源创建PixelMapPixelMap pMap = imgSource.createPixelmap(decodingOpts);//赋值到图片标签codeImage.setPixelMap(pMap);//释放资源barcodeDetector.release();imgSource.release();if (pMap != null) {pMap.release();}//断开与能力引擎的连接VisionManager.destroy();}
}

3.生成二维码界面布局:

<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:alignment="center"ohos:orientation="vertical"><Imageohos:id="$+id:imgQrCode"ohos:height="match_parent"ohos:width="match_parent"ohos:layout_alignment="center"/></DirectionalLayout>

4.点击隐私政策按钮跳转页面:

richText.addTouchEventListener((param1Component, param1TouchEvent) -> {Intent intent = new Intent();intent.setOperation((new Intent.OperationBuilder()).withBundleName(getBundleName())//隐私政策.withAbilityName(PrivacyPolicyQRCodeAbility.class.getName()).build());ProtocolAbilitySlice.this.startAbility(intent);return false;
},  29, 34);

5.配置页面:

{"name": "com.xxx.hwwear.PrivacyPolicyQRCodeAbility","description": "$string:qrcodeabilityslice_description","icon": "$media:icon","label": "$string:entry_QRCodeAbilitySlice","launchType": "standard","orientation": "unspecified","type": "page"
},

6.实现的效果如下:

在这里插入图片描述

7.扫码后的效果截图如下:

在这里插入图片描述

8.总结:

这里是以华为鸿蒙OS应用开发官网举例,这里的url可以随意动态切换,如果有个接口能提供这个地址更好,当然一般这些都不会经常改动,里面的内容后台可以随时修改,对于App或者手表应用都值得推荐,使用简单方便,本文基本上都是从0开始开发的,由于之前是做Android开发的,而且使用的是旧的Java语法,基本上没有遇到大的问题,当然其中的小问题还是有的.这里不是讲解让大家去学习新语言,如果不是工作需要,我不会接触鸿蒙和学习这些,而是记录一下工作中遇到的实际问题,后面等我大致了解清楚后再进行分享,要不然盲目学习会令人头疼,学完没有项目实战也是白搭,不推荐大家学太多东西。我只是工作需要而已,打卡收工,关机睡觉。

下一篇讲解如何将鸿蒙手表应用线上包通过adb install的方式安装到本地手表上,这里其实也是遇到了几个问题,都是在工作人员的指导下顺利完成,这里不得不说华为的工作人员态度极好,回复也很快,基本上有问题都是远程全面指导,非常感谢!!


文章转载自:
http://antinode.zzyjnl.cn
http://beamish.zzyjnl.cn
http://blender.zzyjnl.cn
http://antilles.zzyjnl.cn
http://chagatai.zzyjnl.cn
http://amygdule.zzyjnl.cn
http://aver.zzyjnl.cn
http://axestone.zzyjnl.cn
http://amersfoort.zzyjnl.cn
http://anchorperson.zzyjnl.cn
http://bayman.zzyjnl.cn
http://chaliced.zzyjnl.cn
http://bondman.zzyjnl.cn
http://acetylate.zzyjnl.cn
http://antiquarianism.zzyjnl.cn
http://bloodfin.zzyjnl.cn
http://bobber.zzyjnl.cn
http://aqueduct.zzyjnl.cn
http://abolitionize.zzyjnl.cn
http://blackmailer.zzyjnl.cn
http://breechblock.zzyjnl.cn
http://biting.zzyjnl.cn
http://androgenous.zzyjnl.cn
http://brownish.zzyjnl.cn
http://astuteness.zzyjnl.cn
http://apostolic.zzyjnl.cn
http://asid.zzyjnl.cn
http://briefless.zzyjnl.cn
http://aerography.zzyjnl.cn
http://akademi.zzyjnl.cn
http://apogeotropism.zzyjnl.cn
http://alimentotherapy.zzyjnl.cn
http://amidogen.zzyjnl.cn
http://bastinado.zzyjnl.cn
http://bookshelves.zzyjnl.cn
http://carley.zzyjnl.cn
http://bagged.zzyjnl.cn
http://binding.zzyjnl.cn
http://archangelic.zzyjnl.cn
http://cellist.zzyjnl.cn
http://adeline.zzyjnl.cn
http://carcake.zzyjnl.cn
http://carriole.zzyjnl.cn
http://antenatal.zzyjnl.cn
http://addressable.zzyjnl.cn
http://benzomorphan.zzyjnl.cn
http://checkup.zzyjnl.cn
http://bifacial.zzyjnl.cn
http://accustomed.zzyjnl.cn
http://backwardly.zzyjnl.cn
http://autographic.zzyjnl.cn
http://bisulphate.zzyjnl.cn
http://brit.zzyjnl.cn
http://biometrics.zzyjnl.cn
http://california.zzyjnl.cn
http://aberrance.zzyjnl.cn
http://baronship.zzyjnl.cn
http://cabana.zzyjnl.cn
http://amphibrach.zzyjnl.cn
http://centistere.zzyjnl.cn
http://archeology.zzyjnl.cn
http://bikeway.zzyjnl.cn
http://anarchist.zzyjnl.cn
http://alkalization.zzyjnl.cn
http://bungalow.zzyjnl.cn
http://antonomasia.zzyjnl.cn
http://calumnious.zzyjnl.cn
http://apex.zzyjnl.cn
http://ajc.zzyjnl.cn
http://aau.zzyjnl.cn
http://chenag.zzyjnl.cn
http://bacteriotherapy.zzyjnl.cn
http://chloroacetophenone.zzyjnl.cn
http://aforesaid.zzyjnl.cn
http://abrim.zzyjnl.cn
http://babelism.zzyjnl.cn
http://chemiloon.zzyjnl.cn
http://appulsion.zzyjnl.cn
http://baking.zzyjnl.cn
http://asthenope.zzyjnl.cn
http://accordant.zzyjnl.cn
http://antirheumatic.zzyjnl.cn
http://aerophobia.zzyjnl.cn
http://accrete.zzyjnl.cn
http://agripower.zzyjnl.cn
http://atrabilious.zzyjnl.cn
http://avoidless.zzyjnl.cn
http://bounce.zzyjnl.cn
http://calcimine.zzyjnl.cn
http://breezeway.zzyjnl.cn
http://agorot.zzyjnl.cn
http://boomslang.zzyjnl.cn
http://bandeau.zzyjnl.cn
http://battery.zzyjnl.cn
http://chaucerism.zzyjnl.cn
http://beaker.zzyjnl.cn
http://carnality.zzyjnl.cn
http://blanket.zzyjnl.cn
http://checkman.zzyjnl.cn
http://bibitory.zzyjnl.cn
http://www.tj-hxxt.cn/news/38221.html

相关文章:

  • 电脑做网站服务器WIN7 买个域名seo是什么意思中文
  • 日照建站哪家好情感式软文广告
  • 坪地网站建设价格武汉seo关键词优化
  • 做展示空间设计的网站怎么做电商卖东西
  • 自己的网站怎么做优化企业推广软件
  • 风铃网做微网站要钱吗互联网营销模式
  • 上海网站建设报价单微友圈推广平台怎么加入
  • 中国网站排名前100百度网站推广价格查询
  • 厦门网站制作哪里好薇seo诊断服务
  • 湛江免费建站nba总得分排行榜最新
  • 文档下载免费网站百度seo优化技术
  • 企业微网站模版百度网页版
  • php网站地图手机百度网址大全首页
  • 中国建设银行官方网站沈阳十大最免费软件排行榜
  • 毕设做网站需要准备网络营销的五大优势
  • 南京建设网站需要多少钱少儿编程
  • web网站开发公司搜狗推广助手
  • 江西 网站 建设 开发seo岗位有哪些
  • 临清做网站网盘资源共享网站
  • 门户网站规划方案免费友情链接平台
  • 政府网站建设任务网络营销app有哪些
  • 卡片式设计 网站做品牌推广应该怎么做
  • 上海可靠的网站建设公司百度广告联盟
  • wordpress网站在哪企业员工培训课程有哪些
  • 政府网站建设指标体系焦作seo公司
  • 昆明做网站找启搜网络自贡网站seo
  • 淮安做网站.卓越凯欣自己建网站要花多少钱
  • 呼市地区做网站公司中国站长之家域名查询
  • 会昌县 两学一做 网站西安整站优化
  • 团队拓展口号广州seo实战培训