capacitor-plugin-write-file-permission
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

Capacitor Android android.permission.WRITE_EXTERNAL_STORAGE, android.permission.MANAGE_EXTERNAL_STORAGE permission sometimes requested at runtime. but Capacitor built in Permission not support WRITE_EXTERNAL_STORAGE. so DIY. Android 11+ is supported.

Install

yarn add capacitor-plugin-write-file-permission

or

npm install capacitor-plugin-write-file-permission

Usage

AndroidManifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
import { Plugins } from "@capacitor/core";
import { WriteFilePermissionPlugin } from "capacitor-plugin-write-file-permission";


const WriteFilePermission = Plugins.WriteFilePermission as WriteFilePermissionPlugin;

const permission = await WriteFilePermission.check({ permissionName: "WriteExternalStorage" });

if (!permission.result) {
  await WriteFilePermission.request({ permissionName: "WriteExternalStorage" });
}

Readme

Keywords

Package Sidebar

Install

npm i capacitor-plugin-write-file-permission

Weekly Downloads

15

Version

0.0.9

License

MIT

Unpacked Size

117 kB

Total Files

40

Last publish

Collaborators

  • peixin