harmony 鸿蒙Sharing an Application File

  • 2023-06-24
  • 浏览 (1159)

Sharing an Application File

An application can share a file with another application based on the uniform resource identifier (URI) of the file.

Using startAbility to Start a File Application

startAbility-based file sharing: You can use wantConstant.Flags to specify the read or read/write permission on the file for the target application (application with which the file is shared). The target application can call fs.open to open the file based on the URI and perform read and write operations.

Shareable Application Directories

Application Sandbox Path Description             
/data/storage/el1/base Encrypted database directory under /el1.
/data/storage/el2/base Encrypted database directory under /el2.
/data/storage/el2/distributedfiles Distributed data directory with an account under el2/.

File URI Specifications

The file URIs are in the following format:

file://<bundleName>/<path>

  • file: indicates a file URI.

  • bundleName: specifies the owner of the file, that is, the application that shares the file.

  • path: specifies the application sandbox path of the file.

-

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Core File Kit

harmony 鸿蒙Accessing Application Files (ArkTS)

harmony 鸿蒙Accessing Backup and Restore

harmony 鸿蒙Application Data Backup and Restore Overview

harmony 鸿蒙Backup and Restore Triggered by System Applications

harmony 鸿蒙Application File Overview

harmony 鸿蒙Obtaining Application and File System Space Statistics

harmony 鸿蒙Application Sandbox

harmony 鸿蒙Introduction to Core File Kit

harmony 鸿蒙Developing a File Manager Application (for System Applications Only)

0  赞