Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the error "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag" happens only on some devices?

I'm getting a crash report on Firebase with the message

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.

This error occurs on a Samsung GT-I9500 with Android 19. I can't reproduce the error o my Google Pixel with Android Oreo (27).

I know how to set the flag, but I'm curious to know why this error occurs only on some versions of Android.

Here's how I'm starting the Activity:

    context.getApplicationContext().startActivity(intent);
like image 798
rubenlop88 Avatar asked Oct 23 '25 16:10

rubenlop88


1 Answers

I'm curious to know why this error occurs only on some versions of Android.

Because of a bug. See this issue and this issue.

like image 114
CommonsWare Avatar answered Oct 26 '25 06:10

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!