you can do that like this:
try {
startActivity(getPackageManager().getLaunchIntentForPackage(targetAppPackageName))
} catch (e: NameNotFoundException) {
// target app is not installed
}
you can find the package name of the application you want to open easily, just search the app in the google play website , and then you will take the id parameter ( it is the package name of the app) . Example : you will search on Youtube app on google play , and you will find it in this url :
https://play.google.com/store/apps/details?id=com.google.android.youtube&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5nb29nbGUuYW5kcm9pZC55b3V0dWJlIl0.
the package name is the id param, so it is : com.google.android.youtube
or
you can find the package name of the target app in Apps
section of settings in an android device.