Skip to content

Commit 33c68e5

Browse files
committed
Use ACTION_GET_CONTENT LOCAL_ONLY
1 parent b5e6ef2 commit 33c68e5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

android/src/main/java/com/reactnativedocumentpicker/DocumentPicker.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ public String getName() {
5454

5555
@ReactMethod
5656
public void show(ReadableMap args, Callback callback) {
57-
Intent intent;
58-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
59-
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
60-
} else {
61-
intent = new Intent(Intent.ACTION_PICK);
62-
}
57+
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
6358
intent.addCategory(Intent.CATEGORY_OPENABLE);
59+
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
6460

6561
if (!args.isNull("filetype")) {
6662
ReadableArray filetypes = args.getArray("filetype");
@@ -70,7 +66,7 @@ public void show(ReadableMap args, Callback callback) {
7066
}
7167

7268
this.callback = callback;
73-
69+
intent = Intent.createChooser(intent, "Attach File");
7470
getReactApplicationContext().startActivityForResult(intent, READ_REQUEST_CODE, Bundle.EMPTY);
7571
}
7672

0 commit comments

Comments
 (0)