Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a problem that the calendar schedule that I read with device_calendar is not displayed, so I'm asking for help. #253

Open
nicelee777 opened this issue Apr 23, 2024 · 0 comments

Comments

@nicelee777
Copy link

"I am refreshing the home widget using workmanager. The widget draws data read from the local DB and the calendar schedule (using Device_Calendar API) onto a Canvas, saves it as an image, and then displays it. Strangely, the calendar schedule does not appear. (The method works correctly when executed directly within the app.) I would like some help to understand which part of workmanager I should check and what could be the problem, so I am writing this post."


@pragma("vm:entry-point")
void callbackDispatcher() {
Workmanager().executeTask((taskName, inputData) async {
debugPrint(
'JH: ${DateTime.now().toString()}, Workmanger Doing!!!!!!!!!!!!!!!!!');
CommonData.isWorkManager = true;

return Future.wait<bool?>([
HomeWidgetCalendarMaker(44).sendAndUpdate(),
HomeWidgetCalendarMaker(45).sendAndUpdate(),
HomeWidgetCalendarMaker(55).sendAndUpdate(),
]).then((value) {
return !value.contains(false);
});
});
}

Future<bool?> sendAndUpdate() async {
try {
// Ready to use
await CommonData.init();
await WorktypeHelper().init();
await IsarHelper().initDB();

await _imageMake(); // DB, get the schedule, draw the data imported to Canvas, and save it as an image file.(Prepare images for use in homewidget.)
await _sendData(); // Forwarding information (image) to the widget
await _updateWidget(); // update widget

return true;
} catch (e) {
debugPrint(e.toString());
return false;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant