惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Heimdal Security Blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
J
Java Code Geeks
罗磊的独立博客
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
V
V2EX
WordPress大学
WordPress大学
Google Online Security Blog
Google Online Security Blog
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
月光博客
月光博客
AI
AI
小众软件
小众软件
The GitHub Blog
The GitHub Blog
MongoDB | Blog
MongoDB | Blog
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
美团技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
F
Full Disclosure
B
Blog RSS Feed
Forbes - Security
Forbes - Security
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
Cisco Talos Blog
Cisco Talos Blog
U
Unit 42
Project Zero
Project Zero
H
Hacker News: Front Page
Y
Y Combinator Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
S
Secure Thoughts
The Hacker News
The Hacker News
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 为敢技术

iConsole隐私政策 iConsole用户协议 iCapture隐私政策 iCapture用户协议 上传文件中的.DS_Store问题 iROM用户协议 iROM隐私政策 iConsole请求麦克风权限 博文阅读密码验证 - 博客园 创建图像分类器模型 DevEco Studio:在Windows电脑上启动模拟器,提示未开启Hyper-V iMac / MacBook设置U盘启动 RK3588开发板入门教程 DevEco Studio实用技巧 鸿蒙知识点 Mac系统安装Node.js及配置环境变量 HarmonyOS:如何使用系统自带图标 HarmonyOS:使用本地真机运行应用/服务 HarmonyOS:应用隐私保护 HarmonyOS:应用数据安全
DevEco Testing教程
为敢技术 · 2024-12-07 · via 博客园 - 为敢技术

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ 
➤GitHub地址:https://github.com/strengthen
➤原文地址:https://www.cnblogs.com/strengthen/p/18592823
➤如果链接不是为敢技术的博客园地址,则可能是爬取作者的文章。
➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!支持原创!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

1、官网主页:

https://devecotesting.huawei.com/userPortal/

https://developer.huawei.com/consumer/cn/deveco-testing/

2、DevEco Testing下载:

https://developer.huawei.com/consumer/cn/download/

3、操作步骤:

(1). 将测试手机通过数据线连接至电脑。
(2). 打开 DevEco Testing 工具。
(3). 依次选择 “实用工具” -> “设备投屏” -> “安装应用”。
(4). 选择对应的 .hap 包进行安装。

注意事项:

• 生成 .hap 和 .app 包的目录位置不同:
• .hap 目录:项目根目录 /entry/build/default/outputs/default/entry-default-signed.hap
• .app 目录:项目根目录 /build/outputs/default/项目名称-default-signed.app
• .app 包只能使用生产证书,且仅用于发布到应用商店,无法通过 hdc 命令或者 DevEco Testing 进行安装。

4、获取设备信息

import { deviceInfo } from '@kit.BasicServicesKit';
import { display } from '@kit.ArkUI';
 
@Entry
@Component
struct Page05 {
  build() {
    Column() {
      Button('测试').onClick(() => {
        if (canIUse('SystemCapability.Startup.SystemInfo')) {
          //需要添加权限 ohos.permission.sec.ACCESS_UDID ,但普通app没这个权限,所以代码没办法获取到udid
          //这个权限可以获取 udid 和 SN (Serial Number) (序列号)
          // udid格式 00008020-001D31FF0A8A
          // SN格式 A1B2C3D4E5F6G7H8 【序列号可能包含的信息有生产日期、制造地点等,具体取决于制造商的设计标准。】
          // console.info(`设备udid : ${deviceInfo.udid ? deviceInfo.udid : '-'}`); //获取不到时展示-
          console.info(`设备标识 : ${deviceInfo.serial || '-'}`); //为空字符串或其他“假”值时,输出 '-'。
        } else {
          console.info('设备标识 : -');
        }
 
        let marketNameInfo: string = deviceInfo.marketName;
        console.info('设备名称 : ' + marketNameInfo || '-');
 
        let productModelInfo: string = deviceInfo.productModel;
        console.info('设备型号 : ' + productModelInfo || '-');
 
        let displayVersionInfo: string = deviceInfo.displayVersion;
        console.info('系统版本 : ' + displayVersionInfo || '-');
 
        /*
        常见的 ABI标识符:
        * 32位ARM架构: armeabi-v7a
        * 64位ARM架构: arm64-v8a
        * 32位x86架构: x86
        * 64位x86架构: x86_64
        * MIPS架构: mips, mips64
         * */
        //
        let abiListInfo: string = deviceInfo.abiList;
        if (abiListInfo == 'arm64-v8a' || abiListInfo == 'x86_64') {
          console.info('版本位数 : ' + 64 + '');
        } else if (abiListInfo == 'armeabi-v7a' || abiListInfo == 'x86') {
          console.info('版本位数 : ' + 32 + '');
        } else {
          console.info('版本位数 : ' + '-');
        }
 
        let sdkApiVersionInfo: number = deviceInfo.sdkApiVersion;
        console.info('API版本 : ' + sdkApiVersionInfo || '-');
 
        console.info('CPU类型 : ' + '-') //没查到相关api
 
        console.info('CPU架构 : ' + abiListInfo || '-')
 
        console.info('CPU核数 : ' + '-') //没查到相关api
 
        console.info('GPU类型 : ' + '-') //没查到相关api
 
        console.info('内存大小 : ' + '-') //没查到相关api
 
        let width = display.getDefaultDisplaySync().width
        let height = display.getDefaultDisplaySync().height
        console.info('屏幕尺寸 : ' + width + ' x ' + height) //单位px
      })
    }
    .height('100%')
    .width('100%')
  }
}

打印示例:

设备标识 : -
设备名称 : HUAWEI Mate 60 Pro
设备型号 : ALN-AL80
系统版本 : ALN-AL80 5.0.0.68(SP7C00E68R4P9log)
版本位数 : 64位
API版本 : 13
CPU类型 : -
CPU架构 : arm64-v8a
CPU核数 : -
GPU类型 : -
内存大小 : -
屏幕尺寸 : 1260 x 2720

5、获取应用信息、启动应用。

import { common, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
 
@Entry
@Component
struct Page06 {
  build() {
    Column() {
      Button('启动微博').onClick(() => {
        let want: Want = {
          bundleName: 'com.sina.weibo.stage',
          abilityName: 'EntryAbility'
        };
        (getContext(this) as common.UIAbilityContext).startAbility(want).then(() => {
          console.info('启动微博成功');
        }).catch((err: BusinessError) => {
          console.error(`启动微博失败: ${err.message}`);
        });
      })
    }
    .width('100%')
    .height('100%')
  }
}

6、支持HDC命令

参考HDC官方文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/hdc-V5