mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-04-08 23:31:03 +02:00
fall back to the generic way of launching apps, if one doesnt work
This commit is contained in:
parent
e91917bf1a
commit
661ff469a8
@ -1,7 +1,6 @@
|
|||||||
package com.simplemobiletools.launcher.extensions
|
package com.simplemobiletools.launcher.extensions
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.ActivityNotFoundException
|
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@ -26,10 +25,13 @@ fun Activity.launchApp(packageName: String, activityName: String) {
|
|||||||
addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
}
|
}
|
||||||
} catch (e: ActivityNotFoundException) {
|
|
||||||
showErrorToast(e)
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
try {
|
||||||
|
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
|
||||||
|
startActivity(launchIntent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showErrorToast(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user