1

我正在使用以下方法:

private void placeShortcutIcon(){

    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + mAppData.packageName));
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, mAppData.title);

    Intent.ShortcutIconResource shortcutIconResource = Intent.ShortcutIconResource.fromContext(MainApplication.getAppContext(), R.drawable.ic_launcher);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIconResource);
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");

    MainApplication.getAppContext().sendBroadcast(addIntent);
}

从 IntentService 安装快捷方式时是否存在任何潜在问题?

4

0 回答 0