I want use my app to drop a launcher icon of a 3rd party app.
I have the INSTALL_SHORTCUT permission:
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
I am able to drop the shortcut, however, the icon appears pixelated.
What is the way to get an icon in the size appropriate to the home screen? (like the one Google Play drop after installation)
*I use the following code to get the icon Bitmap for the shortcut:
public static Drawable getInstalledPackageIcon(Context context, String packageName) {
PackageManager packageManager = context.getPackageManager();
try {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
if (applicationInfo != null) {
Drawable iconDrawable = applicationInfo.loadIcon(packageManager);
return iconDrawable;
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
}