Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix boot receiver with logging

Acho Arnold720f6be1487d
diff --git a/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt b/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
index eed7821b..5c4f22f1 100644
--- a/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
+++ b/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
@@ -10,11 +10,15 @@ import timber.log.Timber
class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
- Intent(context, StickyNotificationService::class.java).also {
- context.startForegroundService(it)
- }
+ startStickyNotification(context)
} else {
Timber.e("invalid intent [${intent.action}]")
}
}
-}
+ private fun startStickyNotification(context: Context) {
+ Timber.d("starting foreground service")
+ val notificationIntent = Intent(context, StickyNotificationService::class.java)
+ val service = context.startForegroundService(notificationIntent)
+ Timber.d("foreground service started [${service?.className}]")
+ }
+}