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

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag - Android 10 #45

Open
mdmota opened this issue Nov 17, 2020 · 3 comments

Comments

@mdmota
Copy link

mdmota commented Nov 17, 2020

Flutter 1.22.3
Android 10
pdf_viewer_plugin: ^1.0.0+2

Fatal Exception: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:995)
at android.app.ContextImpl.startActivity(ContextImpl.java:971)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:389)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:389)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:389)
at com.github.barteksc.pdfviewer.link.DefaultLinkHandler.handleUri(DefaultLinkHandler.java:52)
at com.github.barteksc.pdfviewer.link.DefaultLinkHandler.handleLinkEvent(DefaultLinkHandler.java:41)
at com.github.barteksc.pdfviewer.listener.Callbacks.callLinkHandler(Callbacks.java:177)
at com.github.barteksc.pdfviewer.DragPinchManager.checkLinkTapped(DragPinchManager.java:110)
at com.github.barteksc.pdfviewer.DragPinchManager.onSingleTapConfirmed(DragPinchManager.java:73)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:345)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

@mdmota
Copy link
Author

mdmota commented Nov 30, 2020

Complementing to make it easier to track the problem:
When displaying the pdf on the screen with the plugin and clicking on a link inside the pdf, the application crash.
The problem always happens on Android 10. In other versions of android and ios it does not happen.

I need a solution. If I have no alternative I will look for another plugin

@mdmota
Copy link
Author

mdmota commented Dec 2, 2020

@lubritto

@mdmota mdmota changed the title Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag - Android 10 Dec 4, 2020
@myselfuser1
Copy link

This will help https://www.youtube.com/watch?v=gAUVz0U7eyA

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

No branches or pull requests

2 participants