Regarding file access permissions:
- The plugin has read, write, and delete access to its private directory by default:
/data/data/com.ratta.supernote.pluginhost/files/plugins/<pluginID>. - None of the read, write, or delete permissions are granted by default for the
Document,EXPORT,INBOX,MyStyle,Note, andSCREENSHOTdirectories under shared storage (sdcard); each must be requested separately viaplugin.permission.FILE:READ,plugin.permission.FILE:WRITE, andplugin.permission.FILE:DELETE. External SD cards, OTG storage, and other removable storage are likewise governed by these same permissions. Any other directory cannot be read, written, or deleted regardless of whether the corresponding permission is requested.
uses-permissions field of the plugin’s PluginConfig.json (see How to Declare Permissions); otherwise the call will fail.
Returns
Promise<number>: user choice, where0means “don’t allow”,1means “allow this time only”,2means “always allow”, and-1means the user closed the dialog without choosing (treated as “don’t allow”; the dialog will show again on the next call)
- The host may show a permission dialog for the user to choose among “Allow this time only / Always allow / Don’t allow” (the dialog defaults to “Allow this time only”)
desccustomizes only the description shown in the “don’t allow” dialog. It does not change the permission status or the user’s choice options.- “Allow this time only” is valid only for the current plugin session and is revoked when the plugin exits or is closed. Only “Always allow” is persisted and remains valid after restarting the plugin. See How to Request Permissions
- Throws a parameter validation error when
permissionis not a non-empty string ordescis provided with a non-string value - Throws an error when
permissionis not in the supported list (error code1502) - Throws an error when the plugin has not declared this permission in
uses-permissionsinPluginConfig.json(error code1500)