Skip to content

Commit 720f6be

Browse files
committed
Fix boot receiver with logging
1 parent 0b0a669 commit 720f6be

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ import timber.log.Timber
1010
class BootReceiver : BroadcastReceiver() {
1111
override fun onReceive(context: Context, intent: Intent) {
1212
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
13-
Intent(context, StickyNotificationService::class.java).also {
14-
context.startForegroundService(it)
15-
}
13+
startStickyNotification(context)
1614
} else {
1715
Timber.e("invalid intent [${intent.action}]")
1816
}
1917
}
20-
}
18+
private fun startStickyNotification(context: Context) {
19+
Timber.d("starting foreground service")
20+
val notificationIntent = Intent(context, StickyNotificationService::class.java)
21+
val service = context.startForegroundService(notificationIntent)
22+
Timber.d("foreground service started [${service?.className}]")
23+
}
24+
}

0 commit comments

Comments
 (0)