Is there anyone who knows how to do this in Jetpack Compose? I want to create a function in my jetpack compose app that will open Google Authenticator if the app exists and go to play store if it doesn't exist. I found some answers to this question including using the PackageManager pm = getPackageManager() however, it only applies to java programs. Below is the sample code.
import android.content.pm.PackageManager
private fun isAppInstalled(packageName : String) : Boolean
{
val pm : PackageManager = getActivity().getPackageManager() // i can't access the getPackageManager()
var installed = false
installed =
try
{
pm.getPackageInfo(packageName , PackageManager.GET_ACTIVITIES)
true
}
catch (e : PackageManager.NameNotFoundException)
{
false
}
return installed
}