Documentation
¶
Overview ¶
Package backgroundtasks runs Go now and then, with the app closed.
nimbus native plugin add background-tasks
func init() {
backgroundtasks.Handle("sync", func(ctx context.Context) error {
return uploadOrders(ctx)
})
}
backgroundtasks.Schedule(ctx, "sync", time.Hour)
The system picks the moment, from how the phone is used, so treat the interval as a hint. Android runs a task at most every 15 minutes, and iOS far less often, and never after the person force-quits the app. A task has about 25 seconds. There is no screen: ui code doesn't run.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
Handle says what a task does. Call it from init, so that it's there when the system starts the app with no screen.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.