picker_utils

picker_utils (API12+)

🏆Introduction and Recommendations

picker_utils yes harmony-utils A split sub-store includes PickerUtil, PhotoHelper, and ScanUtil. Main solution: When using the harmony-utils three-party library and without using picker capabilities, there is no need to declare camera permissions and storage permissions in the privacy policy.

🌞Download and install

ohpm i @pura/picker_utils

OpenHarmony ohpm For more information, please refer to如何安装 OpenHarmony ohpm 包

📚API detailed explanation使用案例

📂Module Introduction

ModuleIntroduction
PickerUtilPhotos, files (files, pictures, videos) selection and saving, tools
PhotoHelperAlbum related tools
ScanUtilCode tool category (scan code, code image generation, picture identification)

PickerUtil (photographing, file selection and saving, tool class)使用案例

MethodsIntroduction
camera
cameraEasy
Call the system camera, take photos, record videos
selectPhotoPull up the photoPicker interface by selecting mode, users can select one or more pictures/videos
savePhotoPull up photoPicker in the save mode to save the file name of the picture or video resource. If there are no parameters, the user needs to enter it by default
selectDocumentPull up the documentPicker interface by selecting mode, users can select one or more files
saveDocument
saveDocumentEasy
Pull up the documentPicker interface through the save mode, and the user can save one or more files
selectAudioPull up the audioPicker interface by selecting mode, users can select one or more audio files
saveAudioPull up the audioPicker interface through save mode, and users can save one or more audio files
MethodsIntroduction
select
selectEasy
Pull up the photoPicker interface by selecting mode, users can select one or more pictures/videos
saveApply for permission to save pictures or videos to the album.
showAssetsCreationDialogPop-up window authorization save, call the interface to pull up the save confirmation pop-up window.
showAssetsCreationDialogEasyPop-up window authorization save, call the interface to pull up the save confirmation pop-up window, and save.
applyChangesSave security controls, submit media change requests, insert pictures/videos.
getPhotoAssetGet the PhotoAsset object of the corresponding uri, used to read file information

ScanUtil (code tool class (scan code, code image generation, picture identification))使用案例

MethodsIntroduction
startScanForResultCall the default interface to scan the code and use the Promise method to asynchronously return the decoding result
generateBarcodeCode diagram generation, use Promise to return the generated code diagram asynchronously
decodeCall picture identification and use Promise to return the identification result asynchronously
decodeImageCall image data identification capability, use Promise asynchronous callback to return code identification results
onPickerScanForResultPull up the gallery through picker and select the picture, and call the picture identification code
canIUseScanDetermine whether the current device supports code capabilities

🍎Communication and communication 🙏

Any problems found during use can be askedIssueGive us; Of course, we also welcome you to send us a messagePR

🌏Open Source Protocol

This project is based onApache License 2.0, when copying and borrowing codes, please be sure to indicate the source.

0
Subscribe to my newsletter

Read articles from 桃花镇童长老 directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

桃花镇童长老
桃花镇童长老