-
Notifications
You must be signed in to change notification settings - Fork 166
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
Headless Task Function Specifications #227
Comments
Why not make a pull-request? |
Okay, Gimme a moment.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open. |
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you. |
Is your feature request related to a problem? Please describe.
When Initialising the headless function we pass our implementation of the headless function.
While the Documentation clearly shows that we need a function that takes a single HeadlessTask data type.
The "registerHeadlessTask(Function callback)" implementation Just accepts a Function callback, meaning one could mistakenly pass it a Function (String taskId) or Function (int taskId) and the compiler won't raise an issue. This is a mistake I made and I spent a significant amount of time trying to figure out why my headless tasks were not firing but the background tasks were being called when the app is in the foreground.
I admit this was my mistake and could have been prevented if I followed the documentation to the letter but I suggest that the Implementation be tightened so as to prevent others from having such errors.
Describe the solution you'd like
Change the declaration of "BackgroundFetch.registerHeadlessTask(Function callback)" to something like "BackgroundFetch.registerHeadlessTask(Function(HeadlessTask) callback)" hence the compiler would flag it if one passes the wrong fucntion type.
** Edit
While at we could also improve the BackgroundFetch.configure parameter "onFetch" Function declaration from "Function onFetch" to "Function(String taskId) onFetch".
I also suggest the same for the "onTimeout" parameter
The text was updated successfully, but these errors were encountered: