Home > Blockchain >  What is the correct way to terminate an app Android from the code?
What is the correct way to terminate an app Android from the code?

Time:12-24

In an app written with jetpack compose, I finish the app with the following instructions:

val activity = (LocalContext.current as? Activity)
activity?.finish()
exitProcess(0)

In the Android Studio emulator, the app closes but when you click on the square button, the image of the app appears. If I select it, it starts again.

How to close the app so that it disappears completely?

CodePudding user response:

You can use this to close the application:

finishAndRemoveTask();
  • Related