Device
Provides methods to use native device capabilities.
Important
If you want to use the device API methods, you need to declare the usage of these method in feature-usage node in the manifest file.
Available for
Model-driven and canvas apps
Syntax
context.device
Methods
Method | Description |
---|---|
captureAudio | Invokes the device microphone to record audio. |
captureImage | Invokes the device camera to capture the image. |
captureVideo | Invokes the device camera to record video. |
getBarcodeValue | Invokes the device camera to scan the barcode information, such as product number. |
getCurrentPosition | Returns the current location using the device geolocation capability. |
pickFile | Opens a dialog box to select files for the upload. |
Example
private onUploadButtonClick(event: Event): void {
this._context.device.pickFile().then(this.processFile.bind(this), this.showError.bind(this));
}
Sample controls
Device API component
Image upload component
Related articles
Power Apps component framework API reference
Power Apps component framework overview
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: