カスタムランチャーがあります。インストール時に初めて開き、次のコードを使用してランチャーのインテント チューザーを読み込みます。
Intent localIntent = new Intent(Intent.ACTION_MAIN);
localIntent.addCategory(Intent.CATEGORY_HOME);
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(localIntent);
私のアプリはすべてのランチャーを表示します。次に、自分のランチャーではないもう 1 つのランチャーを選択し、デフォルトに設定します。次に上記のコードを実行すると、インテント チューザーが表示されず、デフォルトのランチャーを変更できません。これが私がそれを修正しようとしたものです:
private void callIntenChoiceLauncher(Context c)
{
PackageManager p = getPackageManager();
ComponentName cN = new ComponentName(c, RunDefaultLauncher.class);
p.setComponentEnabledSetting(cN, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Intent selector = new Intent(Intent.ACTION_MAIN);
selector.addCategory(Intent.CATEGORY_HOME);
c.startActivity(selector);
p.setComponentEnabledSetting(cN, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
動いていない。