Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the package name of the current launcher in android 2.3 and above?

How can I get the package name of the current launcher in android 2.3 and above programmatically in Java ?

like image 489
HardCoder Avatar asked Apr 27 '12 04:04

HardCoder


1 Answers

I think you should be able to use PackageManager.resolveActivity(), with the home intent.

Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); String currentHomePackage = resolveInfo.activityInfo.packageName; 
like image 61
JesusFreke Avatar answered Oct 01 '22 01:10

JesusFreke