I solved this by sending the above-mentioned Intent
twice (once to actually show the homescreen, and the second time to move the homescreen back to the default desktop).
Starting launcher and moving to default homescreen
-
29-06-2022 - |
Pergunta
I'd like to start a specific launcher (set by the user), which is working fine with the code below. However, the launcher isn't moving to the user's "default" screen (e.g. the leftmost screen), but rather to the one where the user last left off. Is there a way to tell the launcher to move to the user's default screen upon opening? I've tried Intent.FLAG_ACTIVITY_NEW_TASK
and Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
.
Intent home = new Intent("android.intent.action.MAIN");
home.addCategory("android.intent.category.HOME");
home.setClassName(launcherPackage, launcherActivity);
startActivity(home);
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow