In my application users are able to have a service running in the background that after a certain amount of time opens a website for them. But when you close the app and the timer runs out the website does not open. You can see that the service is still running (foreground service so there is a notification). When the app is still open the website does open.
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(website))
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(browserIntent)
3