Spaces:
Paused
Paused
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 Download android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
-
curl -L -o BootReceiver.kt https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/android/app/src/main/java/com/httpsms/receivers/BootReceiver.kt
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}]") | |
| } | |
| } | |