Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.addCategory(Intent.CATEGORY_LAUNCHER);
shortcutIntent.setClassName(mContext, getClass().getName());
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortCutName);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(mContext, R.drawable.icon));
intent.putExtra("duplicate", false);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(intent);
위의 코드를 이용해서 어플의 아이콘이 바로가기로 등록하였습니다.
intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT"); 코드를 통해 바로가기 삭제도 했고요..
근데 메뉴를 눌러 나타나는 어플의 아이콘을 드래그 해서 바탕화면에 등록하는 것은 바로가기가 아닌가요?
만약에 어플의 아이콘을 드래그해서 바탕화면에 등록되어 있을 때 코드상으로 삭제할 수 있는 방법이 있나요?