From 6d6e7efe4beddee2f5dbffad9f3daa65bb533dc3 Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 27 Aug 2018 20:40:20 -0400 Subject: [PATCH] Ensure that same notification builder is used for life of restore service --- .../main/java/com/moez/QKSMS/service/RestoreBackupService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/com/moez/QKSMS/service/RestoreBackupService.kt b/data/src/main/java/com/moez/QKSMS/service/RestoreBackupService.kt index 77b5193d..c46efa94 100644 --- a/data/src/main/java/com/moez/QKSMS/service/RestoreBackupService.kt +++ b/data/src/main/java/com/moez/QKSMS/service/RestoreBackupService.kt @@ -55,6 +55,8 @@ class RestoreBackupService : Service() { @Inject lateinit var backupRepo: BackupRepository @Inject lateinit var notificationManager: NotificationManager + private val notification by lazy { notificationManager.getNotificationForBackup() } + override fun onCreate() = AndroidInjection.inject(this) override fun onBind(intent: Intent?): IBinder? = null @@ -71,7 +73,6 @@ class RestoreBackupService : Service() { @SuppressLint("CheckResult") private fun start(intent: Intent) { - val notification = notificationManager.getNotificationForBackup() val notificationManager = NotificationManagerCompat.from(this) startForeground(NOTIFICATION_ID, notification.build())