This plugin allows you to share files from the device's file explorer to any capacitor app.
npm install capacitor-share-with-plugin
npx cap sync android
Inside AndroidManifest.xml
, in the activity
element, add a intent-filter
to allow the app to receive images and pdfs from the file explorer and/or other apps.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="application/pdf" />
</intent-filter>
This plugin currently supports only Android devices. Support for IOS will be added soon.
addListener(eventName: 'FILE_SINGLE', listenerFunc: (event: FileDetails) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type | Description |
---|---|---|
eventName |
'FILE_SINGLE' |
Name of the event to listen. |
listenerFunc |
(event: FileDetails) => void |
Callback to be executed when the event occurs. |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'FILE_MULTIPLE', listenerFunc: (event: FileDetails[]) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type | Description |
---|---|---|
eventName |
'FILE_MULTIPLE' |
Name of the event to listen. |
listenerFunc |
(event: FileDetails[]) => void |
Callback to be executed when the event occurs. |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type | Description |
---|---|---|
uri |
string |
URI of the file. |
ext |
string |
Extension of the file. |