UNPKG

3.58 kBTypeScriptView Raw
1import { Observable } from 'rxjs/Observable';
2/**
3 * Configurations items that can be updated.
4 */
5export interface BackgroundModeConfiguration {
6 /**
7 * Title of the background task
8 */
9 title?: String;
10 /**
11 * The text that scrolls itself on statusbar
12 */
13 ticker?: String;
14 /**
15 * Description of background task
16 */
17 text?: String;
18 /**
19 * if true plugin will not display a notification. Default is false.
20 */
21 silent?: boolean;
22 /**
23 * By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
24 */
25 resume?: boolean;
26}
27/**
28* @name Background Mode
29* @description
30* Cordova plugin to prevent the app from going to sleep while in background.
31* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
32*@usage
33* ```typescript
34* import { BackgroundMode } from 'ionic-native';
35*
36* BackgroundMode.enable();
37* ```
38 *
39 * @interfaces
40 * BackgroundModeConfiguration
41*/
42export declare class BackgroundMode {
43 /**
44 * Enable the background mode.
45 * Once called, prevents the app from being paused while in background.
46 */
47 static enable(): void;
48 /**
49 * Disable the background mode.
50 * Once the background mode has been disabled, the app will be paused when in background.
51 */
52 static disable(): Promise<any>;
53 /**
54 * Checks if background mode is enabled or not.
55 * @returns {boolean} returns a boolean that indicates if the background mode is enabled.
56 */
57 static isEnabled(): boolean;
58 /**
59 * Can be used to get the information if the background mode is active.
60 * @returns {boolean} returns a boolean that indicates if the background mode is active.
61 */
62 static isActive(): boolean;
63 /**
64 * Override the default title, ticker and text.
65 * Available only for Android platform.
66 * @param {Configure} options List of option to configure. See table below
67 */
68 static setDefaults(options?: BackgroundModeConfiguration): Promise<any>;
69 /**
70 * Modify the displayed information.
71 * Available only for Android platform.
72 * @param {Configure} options Any options you want to update. See table below.
73 */
74 static configure(options?: BackgroundModeConfiguration): Promise<any>;
75 /**
76 * Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
77 * @param event {string} Event name
78 * @returns {Observable<any>}
79 */
80 static on(event: string): Observable<any>;
81 /**
82 * Android allows to programmatically move from foreground to background.
83 */
84 static moveToBackground(): void;
85 /**
86 * Android allows to programmatically move from background to foreground.
87 */
88 static moveToForeground(): void;
89 /**
90 * Override the back button on Android to go to background instead of closing the app.
91 */
92 static overrideBackButton(): void;
93 /**
94 * Exclude the app from the recent task list works on Android 5.0+.
95 */
96 static excludeFromTaskList(): void;
97 /**
98 * The method works async instead of isActive() or isEnabled().
99 */
100 static isScreenOff(): Promise<boolean>;
101 /**
102 * Turn screen on
103 */
104 static wakeUp(): void;
105 /**
106 * Turn screen on and show app even locked
107 */
108 static unlock(): void;
109}