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

网站增加外链方法淘宝网页设计图片

网站增加外链方法,淘宝网页设计图片,企业网站建设中在方案设计上,网站建设网络推广书生背景 随着HarmoneyOS 应用的井喷式增长#xff0c;各大厂商也都加快了自己原生应用鸿蒙化的脚步#xff0c;今天使用高德打车的时候忽然间想到高德在鸿蒙上有没有实现呢?打开next bate 版本的手机发现高德已经上架了#xff0c;但是功能还不是特别完善。那么几乎每个应用都…背景 随着HarmoneyOS 应用的井喷式增长各大厂商也都加快了自己原生应用鸿蒙化的脚步今天使用高德打车的时候忽然间想到高德在鸿蒙上有没有实现呢?打开next bate 版本的手机发现高德已经上架了但是功能还不是特别完善。那么几乎每个应用都会用到高德的一些定位或者地图SDK他们是否跟其他平台一样方便集成呢 说干就干 回到家立马打开高德官网发现鸿蒙星河版的定位、地图、导航SDK已经上线了 那今天就小试牛刀实现一下鸿蒙星河版的定位SDK集成 集成过程 首先我们点击sdk 的类目进去后查看入门指南可以看到基础要求 从第三步开始这里有的同志可能就有点迷惑了所以我们直接从第三步开始讲解 这里说到我们要拿到appid 我们在page的方法中添加如下代码来实现appid的获取代码如下 aboutToAppear(): void { let flag bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO; let bundleInfo bundleManager.getBundleInfoForSelfSync(flag) let appId bundleInfo.signatureInfo.appId; this.appidappId }可以看到控制台已经打印出了appid 的字符串我们需要把他复制出来等一下要使用这个appid ​ 拿到appid之后进入到高德控制台开始创建我们的应用 ​ 填写好应用名称后选择类型然后新建 Key 名称根据规则填写然后选择HarmoneyOS NEXT平台把我们刚才复制的appid粘贴上去点击提交 提交成功后就为我们创建了一个应用我们把key复制下来等会就用这个key来进行定位的鉴权 接下来我们开始定位项目的配置 第一步配置 module.json5首先声明权限 requestPermissions: [{name: ohos.permission.APPROXIMATELY_LOCATION,reason: $string:Harmony_location_permission_reason,usedScene: {abilities: [Harmony_location_demoAbility],when: always}},{name: ohos.permission.LOCATION,reason: $string:Harmony_location_permission_reason,usedScene: {abilities: [Harmony_location_demoAbility],when: always}},{name: ohos.permission.LOCATION_IN_BACKGROUND,reason: $string:Harmony_location_permission_reason,usedScene: {abilities: [Harmony_location_demoAbility],when: always}},{name: ohos.permission.INTERNET,reason: $string:Harmony_location_permission_reason,usedScene: {abilities: [Harmony_location_demoAbility],when: always}},{name: ohos.permission.KEEP_BACKGROUND_RUNNING,reason: $string:Harmony_location_permission_reason,usedScene: {abilities: [Harmony_location_demoAbility],when: always}}] ... Json第二步在工程的oh-package.json5文件中添加定位开发包从dependencies: { “amap/amap_lbs_common”: “1.0.2”, “amap/amap_lbs_location”: “1.0.1”}Json 第三步初始化定位 1导入所需模块 import { AMapLocationManagerImpl } from amap/amap_lbs_location; import { AMapPrivacyAgreeStatus, AMapPrivacyInfoStatus, AMapPrivacyShowStatus } from amap/amap_lbs_common; import { Permissions } from ohos.abilityAccessCtrl; import common from ohos.app.ability.common; import abilityAccessCtrl, { PermissionRequestResult } from ohos.abilityAccessCtrl; import { BusinessError } from ohos.base;2设置 Key获取Key并初始化隐私政策 创建AMapLocationManagerImpl locationManger?: AMapLocationManagerImpl; private context getContext(this);onPageShow() {//设置KeyAMapLocationManagerImpl.setApiKey(您的key);//初始化隐私政策AMapLocationManagerImpl.updatePrivacyShow(AMapPrivacyShowStatus.DidShow, AMapPrivacyInfoStatus.DidContain, getContext(this))AMapLocationManagerImpl.updatePrivacyAgree(AMapPrivacyAgreeStatus.DidAgree, getContext(this))//创建AMapLocationManagerImplthis.locationManger new AMapLocationManagerImpl(this.context); } Json3动态申请相关权限 reqPermissionsFromUser(permissions: ArrayPermissions): void {let context: Context getContext(this) as common.UIAbilityContext;let atManager: abilityAccessCtrl.AtManager abilityAccessCtrl.createAtManager();// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗atManager.requestPermissionsFromUser(context, permissions).then((data: PermissionRequestResult) {let grantStatus: Arraynumber data.authResults;let length: number grantStatus.length;for (let i 0; i length; i) {if (grantStatus[i] 0) {// 用户授权可以继续访问目标操作} else {// 用户拒绝授权提示用户必须授权才能访问当前页面的功能并引导用户到系统设置中打开相应的权限return;}}// 授权成功}).catch((err: BusinessError) {console.error(Failed to request permissions from user. Code is ${err.code}, message is ${err.message});})}提示 在onPageShow生命周期函数中调用该方法this.reqPermissionsFromUser([ohos.permission.APPROXIMATELY_LOCATION,ohos.permission.LOCATION, ]); 这样我们的工程配置就完成了当我们打开应用后可以发现获取权限的弹窗提示如图所示 然后继续进行单次定位的配置 首先是单次定位模块的导入 import { AMapLocationOption, AMapLocationReGeocodeLanguage, AMapLocationType, IAMapLocationListener } from amap/amap_lbs_location; import geoLocationManager from ohos.geoLocationManager;然后自定一个openLocation的方法我们使用一个按钮来触发单词定位功能初始界面如下 通过点击开启定位来执行单次定位的方法从而获取经纬度 openLocation方法如下 openLocation(){let options: AMapLocationOption {priority: geoLocationManager.LocationRequestPriority.FIRST_FIX, //定位优先配置选项scenario: geoLocationManager.LocationRequestScenario.UNSET, //定位场景设置maxAccuracy: 0, //定位精度 单位米singleLocationTimeout: 3000, //指定单次定位超时时间locatingWithReGeocode: false, //定位是否返回逆地理信息reGeocodeLanguage: AMapLocationReGeocodeLanguage.Chinese, //逆地址语言类型isOffset: false //是否加偏}let listener: IAMapLocationListener {onLocationChanged: (location) {this.locationInfolocation}, onLocationError: (error) {}}; this.locationManger?.setLocationListener(AMapLocationType.Single,listener) //设置定位信息监听this.locationManger?.setLocationOption(AMapLocationType.Single,options) //设置定位配置项this.locationManger?.requestSingleLocation() //单次定位}在button的点击事件中调用Button(开启定位).onClick((){this.openLocation()})可以看到已经获取到了当前的经纬度这样高德的定位功能就完美实现了 写在最后 ●如果你觉得这篇内容对你还蛮有帮助我想邀请你帮我三个小忙 ●点赞转发有你们的 『点赞和评论』才是我创造的动力。 ●关注小编同时可以期待后续文章ing不定期分享原创知识。 ●更多鸿蒙最新技术知识点请移步前往小编https://gitee.com/
http://www.dnsts.com.cn/news/20094.html

相关文章:

  • 做再生料的网站闵行交大附近网站建设
  • 怎么做asp网站网站营销推广怎么做
  • 全网vip视频网站怎么做网站开发图片压缩上传报酬
  • 网站设计就业网站建设考核指标
  • 西昌市住房与城乡建设厅网站建设部网站投诉核查企业名单
  • wordpress 第三方登录 代码wordpress文章页seo设置
  • 个人建站网站网站建设二级菜单
  • 响应式app网站模板昌吉建设局网站
  • 有没有做任务拿佣金的网站网站建设公司antnw
  • 网站备案信息查询接口山东网站建设代理
  • 玩具网站设计产品展示网站源码php
  • 传媒网站建设国内跨境电商平台有哪些?
  • 中文网站建设公司基于php的图书管理系统论文
  • 往网站上传照片怎么做h5网页版制作
  • 什么是网站模板长春网站建设长春
  • 做网站客源wordpress关键词内链插件
  • 专业网站构建苏州网站设计公司
  • 虚拟主机能建设网站吗网站后台登陆显示验证码错误
  • 网站域名备案查询什么网站可以做告白的网页
  • 如何建手机销售网站网站设计是什么
  • 河北邢台企业做网站沧州做网站最好的公司
  • 个人网站模板素材津南区网络推广公司
  • 刘淼 网站开发用户研究 网站
  • 常州城乡建设局网站首页东莞seo托管
  • 一站式装修平台怎么学会建自己网站的方法
  • 没有网站也可以做cpa恢复网址
  • 网站公司倒闭flash 网站头部
  • 湛江有没有做网站的公司建设网站多少钱
  • 快速生成网站程序公司建站网站
  • 大学网站开发模板免费下载拍摄视频制作的广告公司