Closed fauno closed 4 years ago
Made it work with this patch, should I make a PR?
--- node_modules/react-native-send-intent/android/src/main/java/com/burnweb/rnsendintent/RNSendIntentModule.java.orig 2019-09-26 16:15:51.284106362 -0300
+++ node_modules/react-native-send-intent/android/src/main/java/com/burnweb/rnsendintent/RNSendIntentModule.java 2019-09-26 16:15:55.907579564 -0300
@@ -426,8 +443,13 @@
try (final ResponseBody body = response.body()) {
saveFile(body);
+ Uri uri = Uri.fromFile(file);
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
+ uri = FileProvider.getUriForFile(reactContext, reactContext.getPackageName() + ".fileprovider", file);
+ }
+
final Intent intent = new Intent(Intent.ACTION_VIEW)
- .setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
+ .setDataAndType(uri, "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION);
reactContext.startActivity(intent);
Hi @fauno
The PR https://github.com/lucasferreira/react-native-send-intent/pull/99 it's about AndroidX + RN 0.60+ support. Do you think that your problem it's related to this scenario?
By the way if you could make some PR with your improvements that will be great ;)
The PR #99 it's about AndroidX + RN 0.60+ support. Do you think that your problem it's related to this scenario?
No, I was just giving context :)
By the way if you could make some PR with your improvements that will be great ;)
Done! #102
Hi, I can't seem to use this code to install a downloaded app:
Throws this:
Both from master and 1.0.30 using RN 0.59, the target SDK is 28. The only changes I've made to the code are from PR #99. Though it's no clear what should happen, does the apk installer open and offers the user to install the apk? I've checked #78, and added the permission recommended here https://stackoverflow.com/questions/45726654/install-apk-programmatically-in-android-8-api-26