-
Notifications
You must be signed in to change notification settings - Fork 158
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
android.os.FileUriExposedException on installRemoteApp() #101
Comments
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); |
fauno
added a commit
to fauno/react-native-send-intent
that referenced
this issue
Sep 26, 2019
lucasferreira
added a commit
that referenced
this issue
Sep 30, 2019
Uses content:// uris on newest APIs, closes #101
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: