Quota Management (Emergency Save)
Goal
If background time is about to expire, switch to a minimal “save critical data and stop” path.
Actions used
TaskServicesStartTaskAndAllowInBackgroundTaskServicesCancelTask
Flow
When app is suspending:
Start background allowance (
TaskServicesStartTaskAndAllowInBackground) and do your normal save/upload work.
If
quotaWillExpireEventfires:State:
EmergencySaveMinimalStop optional work.
Save only critical state (fastest possible).
Call
TaskServicesCancelTaskto end the task and exit quickly.
Notes
Assign
quotaWillExpireEventonTaskServicesStartTaskAndAllowInBackgroundand add it as a Global Transition to your emergency state.
Last updated
Was this helpful?