Avatar ·

Error startForeground after updating to Android 8.1: how to fix?

Hello everyone! I'm developing an app in Kotlin that uses a background service for location tracking. After updating my device to Android 8.1 (Oreo), my service stopped working and crashes with the error `Context.startForegroundService() did not then call Service.startForeground()`. Here's my service code: ```kotlin class LocationService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val notification = NotificationCompat.Builder(this, "channel_id") .setContentTitle("Service active") .setContentText("Location tracking") .setSmallIcon(R.drawable.ic_location) .build() startForeground(1, notification) return START_STICKY } override f