2
我正在Android 8.0上製作Android應用程序。我已閱讀開發文檔的快捷方式在Using Static Shortcuts 之前更改,但此文檔沒有方法添加啓動器圖標到主屏幕。如何將應用程序啓動器圖標添加到android oreo(8.0)的主屏幕上?
我已經使用方法:8.0
Intent i= new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, i);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
context.getResources().getString(R.string.app_name));
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(context, R.drawable.icon));
intent.setAction(com.android.launcher.action.INSTALL_SHORTCUT);
context.sendBroadcast(intent);
之前如何添加應用程序圖標luncher到主屏幕? 謝謝。
是,面臨同樣的問題:( –