diff --git a/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/action/TaskerPluginRunnerAction.kt b/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/action/TaskerPluginRunnerAction.kt index fc53e55..9d8c811 100644 --- a/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/action/TaskerPluginRunnerAction.kt +++ b/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/action/TaskerPluginRunnerAction.kt @@ -14,7 +14,7 @@ abstract class TaskerPluginRunnerAction() : TaskerP internal fun runWithIntent(context: IntentServiceParallel?, taskerIntent: Intent?) :RunnerActionResult{ if (context == null) return RunnerActionResult(false) if (taskerIntent == null) return RunnerActionResult(false) - context.startForegroundIfNeeded() + startForegroundIfNeeded(context) try { val input = taskerIntent.getTaskerInput(context, getInputClass(taskerIntent)) var result = run(context, input) diff --git a/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/runner/TaskerPluginRunner.kt b/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/runner/TaskerPluginRunner.kt index 39a2af8..a80466c 100644 --- a/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/runner/TaskerPluginRunner.kt +++ b/taskerpluginlibrary/src/main/java/com/joaomgcd/taskerpluginlibrary/runner/TaskerPluginRunner.kt @@ -47,6 +47,11 @@ abstract class TaskerPluginRunner { TaskerPluginRunner.startForegroundIfNeeded(this, notificationProperties) } + @TargetApi(Build.VERSION_CODES.O) + fun startForegroundIfNeeded(intentServiceParallel: IntentServiceParallel) { + TaskerPluginRunner.startForegroundIfNeeded(intentServiceParallel, notificationProperties) + } + companion object { const val NOTIFICATION_CHANNEL_ID = "taskerpluginforegroundd"