Skip to content

support for audio and multiple file type #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ Add What ever Want to share MIME Type so only include you want to share your App
<data android:mimeType="image/*" />
<data android:mimeType="application/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="application/*" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void getFilepath(Callback successCallback) {
if ("text/plain".equals(type)) {
String input = intent.getStringExtra(Intent.EXTRA_TEXT);
successCallback.invoke(input);
} else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) {
} else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/") || type.startsWith("audio/")) {
Uri fileUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (fileUri != null) {
successCallback.invoke(fileUri.toString());
Expand All @@ -58,7 +58,7 @@ public void getFilepath(Callback successCallback) {
Toast.makeText(reactContext, "Type is not support", Toast.LENGTH_SHORT).show();
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) {
if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/") || type.startsWith("*/") || type.startsWith("audio/")) {
ArrayList<Uri> fileUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (fileUris != null) {
String completeString = new String();
Expand Down Expand Up @@ -91,4 +91,4 @@ public void clearFilePath() {
public String getName() {
return "RNFileShareIntent";
}
}
}