I just want to notice that startActivity
from outside an activity is valid in some android versions (between N and O-MR1) and the interesting point is that it is a bug in android source code!
This is the comment above startActivity
implementation. See here.
Calling start activity from outside an activity without FLAG_ACTIVITY_NEW_TASK is generally not allowed, except if the caller specifies the task id the activity should be launched in. A bug was existed between N and O-MR1 which allowed this to work.