Skip to content

Commit 661ff46

Browse files
committed
fall back to the generic way of launching apps, if one doesnt work
1 parent e91917b commit 661ff46

File tree

1 file changed

+6
-4
lines changed
  • app/src/main/kotlin/com/simplemobiletools/launcher/extensions

1 file changed

+6
-4
lines changed

app/src/main/kotlin/com/simplemobiletools/launcher/extensions/Activity.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.simplemobiletools.launcher.extensions
22

33
import android.app.Activity
4-
import android.content.ActivityNotFoundException
54
import android.content.ComponentName
65
import android.content.Intent
76
import android.net.Uri
@@ -26,10 +25,13 @@ fun Activity.launchApp(packageName: String, activityName: String) {
2625
addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
2726
startActivity(this)
2827
}
29-
} catch (e: ActivityNotFoundException) {
30-
showErrorToast(e)
3128
} catch (e: Exception) {
32-
showErrorToast(e)
29+
try {
30+
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
31+
startActivity(launchIntent)
32+
} catch (e: Exception) {
33+
showErrorToast(e)
34+
}
3335
}
3436
}
3537

0 commit comments

Comments
 (0)