Device

提供使用本机设备功能的方法。

重要

如果要使用设备 API 方法,需要在清单文件中 的功能使用 节点中声明这些方法的用法。

适用于

模型驱动和画布应用

Syntax

context.device

Methods

方法 Description
captureAudio 调用设备麦克风来录制音频。
captureImage 调用设备相机来捕获图像。
captureVideo 调用设备相机来录制视频。
getBarcodeValue 调用设备相机来扫描条形码信息,例如产品名称。
getCurrentPosition 使用设备地理位置功能返回当前位置。
pickFile 打开一个对话框以选择要上传的文件。

Example

 private onUploadButtonClick(event: Event): void {
    this._context.device.pickFile().then(this.processFile.bind(this), this.showError.bind(this));
  }

示例控件

设备 API 组件
图像上传组件

Power Apps 组件框架 API 参考
Power Apps 组件框架概述