From 5eaf72f3e75a5f477f1850f200cdcada46e79ad8 Mon Sep 17 00:00:00 2001 From: Marcos Holgado Date: Fri, 3 Jul 2020 17:54:16 +0100 Subject: [PATCH] Register receiver onCreate and do not unregister because we don't need to --- .../com/duckduckgo/app/global/DuckDuckGoApplication.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt index 361e2cd36b8c..0f82e7fd951e 100644 --- a/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt +++ b/app/src/main/java/com/duckduckgo/app/global/DuckDuckGoApplication.kt @@ -194,6 +194,7 @@ open class DuckDuckGoApplication : HasAndroidInjector, Application(), LifecycleO scheduleOfflinePixels() notificationRegistrar.registerApp() + registerReceiver(shortcutReceiver, IntentFilter(ShortcutBuilder.USE_OUR_APP_SHORTCUT_ADDED_ACTION)) initializeHttpsUpgrader() submitUnsentFirePixels() @@ -299,7 +300,6 @@ open class DuckDuckGoApplication : HasAndroidInjector, Application(), LifecycleO Timber.i("Suppressing app launch pixel") return } - registerReceiver(shortcutReceiver, IntentFilter(ShortcutBuilder.USE_OUR_APP_SHORTCUT_ADDED_ACTION)) pixel.fire(APP_LAUNCH) } @@ -312,11 +312,6 @@ open class DuckDuckGoApplication : HasAndroidInjector, Application(), LifecycleO } } - @OnLifecycleEvent(Lifecycle.Event.ON_STOP) - fun onAppStopped() { - unregisterReceiver(shortcutReceiver) - } - companion object { private const val APP_RESTART_CAUSED_BY_FIRE_GRACE_PERIOD: Long = 10_000L }