I am having a problem opening urls in web browser from Instant App. The code that works on the regular app catches ActivityNotFoundExeption. Can anyone tell me what am I doing wrong and how to fix it? Before anyone asks, the link in storeInformation.website already has "http" or "https"
No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://vero.featherapp.net/... flg=0x10000000 pkg=com.android.chrome }
{
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(storeInformation.website))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.setPackage("com.android.chrome")
try {
startActivity(intent)
} catch (ex: ActivityNotFoundException) {
// Chrome browser presumably not installed so allow user to choose instead
Log.d(TAG, ex.localizedMessage)
intent.setPackage(null)
startActivity(intent)
} catch (e : Exception){
Log.d(TAG, e.localizedMessage)
}