flutter_background_service icon indicating copy to clipboard operation
flutter_background_service copied to clipboard

Background service execute more than 1 times at the same time

Open kkooi opened this issue 9 months ago • 2 comments

Hi,

During the background is running. Sometimes when the background is running, executes the function more than 1 times at the same time. I try to get/post the data through API. some will cause my data to duplicate.

Timer.periodic(const Duration(minutes: 5), (timer) async { if (!isrunning) { if (service is AndroidServiceInstance) { if (await service.isForegroundService()) { foregroundServiceStartController.runService(flutterLocalNotificationsPlugin).then((value) { isrunning = value; }); } } }

how to prevent executing functions more than 1 time at the same time.

any idea?

kkooi avatar May 04 '24 11:05 kkooi