package sh.lajo.buddy import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.os.Build class BootReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action == Intent.ACTION_BOOT_COMPLETED) { val prefs = context.getSharedPreferences("app_prefs", Context.MODE_PRIVATE) if (!prefs.getBoolean("onboardingFinished", false)) return val serviceIntent = Intent(context, WebSocketService::class.java) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { context.startForegroundService(serviceIntent) } else { context.startService(serviceIntent) } } } }