ForegroundConfig

data class ForegroundConfig(val notificationTitle: String, val notificationChannelId: String = "kmpworker_foreground", val notificationChannelName: String = "Background Tasks", val notificationId: Int = 42, val notificationIcon: Int = 0)

Configuration for running a task as a foreground service on Android.

When set on a TaskRequest with TaskPriority.HIGH, the task will run as an expedited WorkManager job with a persistent notification.

val foreground = ForegroundConfig(
notificationTitle = "Uploading file...",
notificationChannelId = "upload_channel",
notificationChannelName = "Uploads",
notificationId = 1001
)

Parameters

notificationTitle

Title shown in the foreground notification.

notificationChannelId

Android notification channel ID (required for API 26+).

notificationChannelName

Human-readable channel name.

notificationId

Unique ID for the notification.

notificationIcon

Resource ID for the small icon. Defaults to the app icon.

Constructors

Link copied to clipboard
constructor(notificationTitle: String, notificationChannelId: String = "kmpworker_foreground", notificationChannelName: String = "Background Tasks", notificationId: Int = 42, notificationIcon: Int = 0)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard