Check out example codes for "kill other apps in kotlin". It will help you in understanding the concepts better.

Code Example 1

// add this permission to AndroidManifest.xml
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
  
//and use this code to kill the process
  
val am = getSystemService(Activity.ACTIVITY_SERVICE) as ActivityManager
am.killBackgroundProcesses(packageName)

Learn ReactJs, React Native from akashmittal.com