After reading around for hours, I am little bit unclear on how an Activity and a Foreground service can co-exists in an android app.
Taking example of a Music Player app -
I create an Activity for displaying the UI and controls for the music player, and the music player gets started into a Foreground service. Based on the articles I have read.
And based on this -
A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise). This means that, if your service is going to do any CPU intensive work or blocking operations (such as MP3 playback or networking), you should create a new thread within the service to do that work.
So, now at this time, if I have to perform any actions on UI in my Activity, why will I not see an ANR or any other kind of sluggishness, since the music and user actions are both happening on the UI thread ?