[Android] Fix actionViewIntent for SDK < 24 #685
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
actionViewIntent does not work for SDK < 24
It seems that this part of the code was introduced when migrating to Android file providers: wkh237#358
The blog post about it: https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en says that from the moment we set targetSdkVersion to something superior to 24, we need to pass through a file provider: "This behavior will happen only when you change your app's targetSdkVersion to 24 or above".
I imagine that the dev that implemented it thinking (with good will) that he needed to separate the two flows depending on the device Android SDK version at the runtime, but now that the default config is set as 28 in the build.gradle, we should remove this logic. File providers are meant to work even for Android SDK < 24, it all depends on the target version set when we build.
Also, I take some part of the PR for [Android] Promise resolve and reject for actionViewIntent (#535) as it is very useful to have a promise rejection when the intent is not resolved (kudos to MikeChugunov)