Skip to content

Commit

Permalink
fix: Fix creation of multiple tasks (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiros committed Mar 22, 2022
1 parent cfbb451 commit df268bd
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,17 @@ public int onStartCommand(Intent intent, int flags, int startId) {
createNotificationChannel(bgOptions.getTaskTitle(), bgOptions.getTaskDesc()); // Necessary creating channel for API 26+
// Create the notification
final Notification notification = buildNotification(this, bgOptions);

startForeground(SERVICE_NOTIFICATION_ID, notification);
return super.onStartCommand(intent, flags, startId);

HeadlessJsTaskConfig taskConfig = this.getTaskConfig(intent);

if (taskConfig != null) {
this.stopForeground(false);
this.startTask(taskConfig);
}

return START_NOT_STICKY;
}

private void createNotificationChannel(@NonNull final String taskTitle, @NonNull final String taskDesc) {
Expand Down

0 comments on commit df268bd

Please sign in to comment.