ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca
Raw History Blame
1.18 kB
package com.httpsms.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.httpsms.Constants
import com.httpsms.Settings
import com.httpsms.services.StickyNotificationService
import timber.log.Timber
class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
startStickyNotification(context)
} else {
Timber.e("invalid intent [${intent.action}]")
}
}
private fun startStickyNotification(context: Context) {
if(!Settings.getActiveStatus(context, Constants.SIM1) && !Settings.getActiveStatus(context, Constants.SIM2)) {
Timber.d("active status is false, not starting foreground service")
return
}
Timber.d("starting foreground service")
val notificationIntent = Intent(context, StickyNotificationService::class.java)
val service = context.startForegroundService(notificationIntent)
Timber.d("foreground service started [${service?.className}]")
}
}