How to get the package name of the current run in android?

I want to get the package name of the current launcher that I just installed. I was trying to use the link https://stackoverflow.com/a/464632/

but it gives the result as an "android". I want the full name of the launch.

List of launchers

I want the list of installed launchers selected and the current launcher selected

.thanks in advance

+11
android
source share
3 answers

Hi, you can get the current name of the launch package using the following code:

PackageManager localPackageManager = getPackageManager(); Intent intent = new Intent("android.intent.action.MAIN"); intent.addCategory("android.intent.category.HOME"); String str = localPackageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName; Log.e("Current launcher Package Name:",str); 
+22
source share

as Fede's answer Get a list of all launchers in Android

Get a list of all installed launchers.

 Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); List<ResolveInfo> lst = getPackageManager().queryIntentActivities(intent, 0); if (!lst.isEmpty()) { for (ResolveInfo resolveInfo : lst) { Log.d("Test", "New Launcher Found: " + resolveInfo.activityInfo.packageName); } } 
+2
source share

The following code works fine to get the name of the current startup application package.

 Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); String currentLauncherName= resolveInfo.activityInfo.packageName; Log.d("Current Launcher: ", currentLauncherName); 
0
source share

All Articles