diff --git a/app/src/main/kotlin/com/looker/droidify/Droidify.kt b/app/src/main/kotlin/com/looker/droidify/Droidify.kt index cfd4f7fa8..1de7dbd6e 100644 --- a/app/src/main/kotlin/com/looker/droidify/Droidify.kt +++ b/app/src/main/kotlin/com/looker/droidify/Droidify.kt @@ -6,6 +6,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter +import android.os.Build import androidx.appcompat.app.AppCompatDelegate import androidx.hilt.work.HiltWorkerFactory import androidx.work.Configuration @@ -98,14 +99,18 @@ class Droidify : Application(), SingletonImageLoader.Factory, Configuration.Prov Database.InstalledAdapter.putAll(installedItems) } appScope.launch { - registerReceiver( - InstalledAppReceiver(packageManager), - IntentFilter().apply { - addAction(Intent.ACTION_PACKAGE_ADDED) - addAction(Intent.ACTION_PACKAGE_REMOVED) - addDataScheme("package") - }, - ) + val filter = IntentFilter().apply { + addAction(Intent.ACTION_PACKAGE_ADDED) + addAction(Intent.ACTION_PACKAGE_REMOVED) + addDataScheme("package") + } + val receiver = InstalledAppReceiver(packageManager) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED) + } else { + @Suppress("UnspecifiedRegisterReceiverFlag") + registerReceiver(receiver, filter) + } } }