目录

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

Based on the sharing method of file picker (startAbility), an app can share a single file and grant read-only or read/write permissions to other apps through the wantConstant.Flags API of ohos.app.ability.wantConstant. The receiving app can open the URI through fileIo.open and perform read/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>

  • URI processing involves encoding and decoding. The system cannot guarantee the availability of the URI address that an application combines by itself.
  • You are advised to use the APIs provided by the system to obtain URIs, for example, getUriFromPath().