I need to get package name of an app which post notification about a missed call. As far as I understand it makes dialer app of a device. Can I get package name of dialer app on the device, I need it from API 19?
You can filter all dialer applications using Intent.ACTION_DIAL
action and PackageManager.queryIntentActivities(...)
. Where it will return list of applications which can dial phone. Read more at Android: How to show a list of dialer app installed on my device instead of directly calling default dialer
You can use below code, as it is
public List<String> getPackagesOfDialerApps(Context context){
List<String> packageNames = new ArrayList<>();
// Declare action which target application listen to initiate phone call
final Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
// Query for all those applications
List<ResolveInfo> resolveInfos = context.getPackageManager().queryIntentActivities(intent, 0);
// Read package name of all those applications
for(ResolveInfo resolveInfo : resolveInfos){
ActivityInfo activityInfo = resolveInfo.activityInfo;
packageNames.add(activityInfo.applicationInfo.packageName);
}
return packageNames;
}