I need to check if my dialer app is default dialer app or not. Currently I'm using this code
private boolean isDefault() {
Intent i=new Intent(Intent.ACTION_DIAL);
i.addCategory(Intent.CATEGORY_DEFAULT);
ResolveInfo info=getPackageManager().resolveActivity(i,0);
CharSequence name=getPackageManager().getApplicationLabel(info.activityInfo.applicationInfo);
Log.d(TAG, "isDefault: "+name);
return name==getString(R.string.app_name);
}
But name
is always "Android System"
Your help will be greatly appreciated. Thanks