 
         return customSource
     }
+
+    func beginBackgroundTaskForFilestack() {
+        backgroundTaskID = UIApplication.shared.beginBackgroundTask(withName: "Filestack Background Upload") {
+            self.endBackgroundTaskForFilestack()
+        }
+    }
+
+    func endBackgroundTaskForFilestack() {
+        if let backgroundTaskID = backgroundTaskID {
+            UIApplication.shared.endBackgroundTask(backgroundTaskID)
+            self.backgroundTaskID = .invalid
+        }
+    }
 }

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        setupFilestackClient()

    }

    /// Returns a custom `LocalSource` configured to use an user-provided `SourceProvider`.
    func customLocalSource() -> LocalSource {
        let customSourceTitle = "Custom Source"
        let customProvider = MyCustomSourceProvider()

