juan ezquerro
juan ezquerro

Reputation: 145

Get system default package name

How can I know which is the package name of default system app if user has one defined? By example get the package name of system default music app to stop it

Upvotes: 0

Views: 477

Answers (1)

juan ezquerro
juan ezquerro

Reputation: 145

solved:

String mKillAppName = null;

headsetPlugIntent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
    Intent.CATEGORY_APP_MUSIC);

ResolveInfo da = mContext.getPackageManager()
    .resolveActivity(headsetPlugIntent,PackageManager.MATCH_DEFAULT_ONLY);

mKillAppName = da.activityInfo.packageName;

Upvotes: 1

Related Questions