How can i start a new application using its package name? I don't have information about what activity is the main one.
Just use these following two lines, so you can launch any installed application whose package name is known: Intent launchIntent = getPackageManager(). getLaunchIntentForPackage("com. example.
You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com. example.
All Android apps have a package name. The package name uniquely identifies the app on the device; it is also unique in the Google Play store.
The applicationId exactly matches the Java-style package name you chose during project setup in android studio. However, the application ID and package name are independent of each other beyond this point.
Just use these following two lines, so you can launch any installed application whose package name is known:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.abc"); startActivity( launchIntent );
If you don't know the package name of application that you wanted to launch then try your hand on:
PackageManager pm; pm = getPackageManager(); // get a list of installed apps. packages = pm.getInstalledApplications(0);
For more information, refer to this link: Using Package Manager.
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