-
Notifications
You must be signed in to change notification settings - Fork 110
/
SDLBackgroundTaskManager.h
44 lines (35 loc) 路 1.26 KB
/
SDLBackgroundTaskManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// SDLBackgroundTaskManager.h
// SmartDeviceLink
//
// Created by Nicole on 6/25/19.
// Copyright 漏 2019 smartdevicelink. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Class for managing a background task.
*/
@interface SDLBackgroundTaskManager : NSObject
- (instancetype)init NS_UNAVAILABLE;
/**
* Convenience init for starting a background task with a specific name.
*
* @param backgroundTaskName The name for the background task
* @return A SDLBackgroundTaskManager object
*/
- (instancetype)initWithBackgroundTaskName:(NSString *)backgroundTaskName;
/**
* Starts a background task that allows the app to establish a session while app is backgrounded. If the app is not currently backgrounded, the background task will remain dormant until the app moves to the background.
*/
- (void)startBackgroundTask;
/**
* Cleans up a background task when it is stopped. This should be called when:
*
* 1. The app has established a session.
* 2. The system has called the `expirationHandler` for the background task. The system may kill the app if the background task is not ended when `expirationHandler` is called.
*/
- (void)endBackgroundTask;
@end
NS_ASSUME_NONNULL_END