How to know whether android shortcut already exist
ex.
public void createShortcut(String url,String shortcutName, String type, Bitmap img)
{
Intent shortcutIntent = new Intent();
shortcutIntent.setAction(Intent.ACTION_VIEW);
if(type.equalsIgnoreCase("web")) {
Uri uri = Uri.parse(url);
shortcutIntent.setData(uri);
}
else if (type.equalsIgnoreCase("app")) {
Log.d("DEBUGGING", "Inside app installation " + url + " : " + group + " : " + shortcutName);
shortcutIntent.setClassName(url,group);
}
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutName);
addIntent.putExtra("duplicate", false);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, scaledBitmap);
// addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, R.drawable.ic_launcher);
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(addIntent);
// Toast mToast = Toast.makeText(this, "shortcut created", Toast.LENGTH_SHORT);
// mToast.show();
}
AllStuffON
Android
Exist
How to know
Shortcut
How to know whether android shortcut already exist ex.