Skip to content
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

Add the FLAG_ACTIVITY_NEW_TASK flag. #317

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

wakeless
Copy link

@wakeless wakeless commented Mar 7, 2019

This is caused by an error on Android 9: 'Error: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?'

This is caused by an error on Android 9: 'Error: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?'
@andresouza
Copy link

It would be nice to have this one merged. Thank you!

@acatalina
Copy link

I need to fork this repo just for that reason but probably rather than enforce it for everyone it should be pass as a parameter instead?

andreasbergqvist added a commit to andreasbergqvist/rn-fetch-blob that referenced this pull request Apr 5, 2019
@squalvj
Copy link

squalvj commented Apr 16, 2019

+1 please someone merge this PR, it works!

@wakeless
Copy link
Author

wakeless commented May 2, 2019

FWIW this has been working in production for us for quite some time.

@mouchegmouradian
Copy link

Any chance someone merges this ? (and all the other 39 PRs) or give permissions to other people so they can do the merges.

@AdeilsonSuperlogica
Copy link

I solved this issue with a workaround.
Just add this in your package.json postinstall:

"postinstall": "exec sed -i '' '122i\\\nintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);' node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java"

I used this PR to make changes. I hope it helps you.

@ErickMaeda
Copy link

Thanks @AdeilsonSuperlogica it solved my issue!

@superRenanC
Copy link

Solved for me @AdeilsonSuperlogica

@ganesh98a
Copy link

ganesh98a commented May 29, 2019

So basically this needs to be added to line 122-123 of file android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

   intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

if above step is not working to do the below step:
overwrite the line 121 in android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  // line 121 
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);   // line 122 

@pedrosobral
Copy link

pedrosobral commented Jun 19, 2019

Just in case, you guys can also install the package directly from this branch.

yarn add git+https://github.com/Ferocia/rn-fetch-blob.git#android-9-open-file

Thanks, @wakeless!

@walterholohan
Copy link

@Traviskn do you think this PR will get merged anytime soon? Ive come across this issue when trying to open a PDF on Android using RNFetchBlob.android.actionViewIntent( targetPath, 'application/pdf' )

@Maddumage
Copy link

#317 (comment)
This worked me well

nigelsim added a commit to nigelsim/rn-fetch-blob that referenced this pull request Aug 1, 2019
nigelsim added a commit to nigelsim/rn-fetch-blob that referenced this pull request Aug 1, 2019
Copy link

@Gutyn Gutyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this going in or not?

@Traviskn
Copy link

Thank you for all the testing confirmation that this PR fixes the described issue, apologies for the delayed review

@Traviskn Traviskn merged commit 90ce0c4 into joltup:master Sep 26, 2019
@nobady90
Copy link

nobady90 commented Feb 3, 2020

as already asked by @bova80 there are many who do not want or be able to update react-native to version 0.60 or higher... so is it possible to update to have a merge to solve this problem also in version 0.10.15?
Thanks

@LouisJS
Copy link

LouisJS commented Feb 17, 2020

Is this fix available in 0.10.15 ? Because i'm still facing it

@V1adau
Copy link

V1adau commented Feb 25, 2020

+1, still facing this issue in 0.10.15

@iaminvictus1993
Copy link

mark Add the FLAG_ACTIVITY_NEW_TASK flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.