From 5d695ec0ea49177cf4627196e8ebcf2e7a1ce886 Mon Sep 17 00:00:00 2001 From: Josia Pietsch Date: Sat, 29 Mar 2025 18:45:53 +0100 Subject: [PATCH] fix #135 --- app/src/main/java/de/jrpie/android/launcher/Functions.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/jrpie/android/launcher/Functions.kt b/app/src/main/java/de/jrpie/android/launcher/Functions.kt index 7bbbdb5..df57008 100644 --- a/app/src/main/java/de/jrpie/android/launcher/Functions.kt +++ b/app/src/main/java/de/jrpie/android/launcher/Functions.kt @@ -38,6 +38,8 @@ import androidx.core.net.toUri const val LOG_TAG = "Launcher" +const val REQUEST_SET_DEFAULT_HOME = 42 + fun isDefaultHomeScreen(context: Context): Boolean { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val roleManager = context.getSystemService(RoleManager::class.java) @@ -62,8 +64,9 @@ fun setDefaultHomeScreen(context: Context, checkDefault: Boolean = false) { && !isDefault // using role manager only works when µLauncher is not already the default. ) { val roleManager = context.getSystemService(RoleManager::class.java) - context.startActivity( - roleManager.createRequestRoleIntent(RoleManager.ROLE_HOME) + context.startActivityForResult( + roleManager.createRequestRoleIntent(RoleManager.ROLE_HOME), + REQUEST_SET_DEFAULT_HOME ) return }