If I have an ApplicationInfo instance of a particular app, how can I make an Intent to launch the app?
I tried
Intent intent = new Intent(ApplicationInfoInstance.packageName);
but it gives an exception. The app is installed so the exception is not due to that.
I think I need to use
setClassName (String packageName, String className);
Could someone direct me to obtain these two values?
Because most of my apps returns NULL for ApplicationInfoInstance.className;
Thank you.
Just use these following two lines, so you can launch any installed application whose package name is known: Intent launchIntent = getPackageManager(). getLaunchIntentForPackage("com. example.
If I have an ApplicationInfo instance of a particular app, how can I make an Intent to launch the app?
There is no such thing as "launch the app" in Android. An "app" may have zero, one, or several activities that are in the launcher and are designed to be launched.
You should be able to use getLaunchIntentForPackage()
on PackageManager
to get an Intent
that meets your needs (or null if there is no such Intent
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With