|
@@ -1,5 +1,8 @@
|
1
|
1
|
package com.RNFetchBlob;
|
2
|
2
|
|
|
3
|
+import android.content.Intent;
|
|
4
|
+import android.net.Uri;
|
|
5
|
+
|
3
|
6
|
import com.facebook.react.bridge.Callback;
|
4
|
7
|
import com.facebook.react.bridge.Promise;
|
5
|
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
@@ -46,6 +49,20 @@ public class RNFetchBlob extends ReactContextBaseJavaModule {
|
46
|
49
|
|
47
|
50
|
}
|
48
|
51
|
|
|
52
|
+ @ReactMethod
|
|
53
|
+ public void actionViewIntent(String path, String mime, Promise promise) {
|
|
54
|
+ try {
|
|
55
|
+ Intent intent= new Intent(Intent.ACTION_VIEW)
|
|
56
|
+ .setDataAndType(Uri.parse("file://" + path), mime);
|
|
57
|
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
58
|
+
|
|
59
|
+ this.getReactApplicationContext().startActivity(intent);
|
|
60
|
+ promise.resolve(null);
|
|
61
|
+ } catch(Exception ex) {
|
|
62
|
+ promise.reject(ex.getLocalizedMessage());
|
|
63
|
+ }
|
|
64
|
+ }
|
|
65
|
+
|
49
|
66
|
@ReactMethod
|
50
|
67
|
public void createFileASCII(final String path, final ReadableArray dataArray, final Callback callback) {
|
51
|
68
|
threadPool.execute(new Runnable() {
|