Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class ForegroundServiceManager {
ForegroundTaskOptions.updateData(context, argsMap)
ForegroundTaskData.updateData(context, argsMap)
NotificationContent.updateData(context, argsMap)
ContextCompat.startForegroundService(context, nIntent)
// Use startService instead of startForegroundService because the service
// is already running in the foreground and we only need to deliver the
// update command. This avoids the startForeground() contract requirement.
context.startService(nIntent)
}

/** Stop the foreground service. */
Expand All @@ -76,7 +79,10 @@ class ForegroundServiceManager {
ForegroundTaskOptions.clearData(context)
ForegroundTaskData.clearData(context)
NotificationContent.clearData(context)
ContextCompat.startForegroundService(context, nIntent)
// Use startService instead of startForegroundService because the service
// is already running in the foreground and we only need to deliver the
// stop command. This avoids the startForeground() contract requirement.
context.startService(nIntent)
}

/** Send data to TaskHandler. */
Expand Down