I am working on an Android application intended to run only on devices with two screens (running API 29). I have two somewhat related questions:
1. Is it possible to launch the application directly on the second display instead of primary display? Right now it launches on the primary display and I am then able to launch the subsequent activity on second display using ActivityOptions
.
For example:
val exampleIntent = Intent(this, ExampleActivity::class.java)
exampleIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(
exampleIntent,
ActivityOptions.makeBasic().setLaunchDisplayId(secondDisplayId).toBundle()
)
2) Is it possible to explicitly finish an activity running on second display before relaunching it?
I have a usecase in which I need to relaunch an activity on the second display (from primary display) when some condition is met. However, if that activity is already running on the second screen then it is not relaunched.
Is there a way to finish/close that activity before launching it?