1 | import { ApplicationCommon } from './application-common';
|
2 |
|
3 | export * from './application-common';
|
4 | export * from './application-interfaces';
|
5 |
|
6 | export const Application: ApplicationCommon;
|
7 |
|
8 | export class AndroidApplication extends ApplicationCommon {
|
9 | /**
|
10 | * @deprecated Use `Application.android.activityCreatedEvent` instead.
|
11 | */
|
12 | static readonly activityCreatedEvent = 'activityCreated';
|
13 | /**
|
14 | * @deprecated Use `Application.android.activityDestroyedEvent` instead.
|
15 | */
|
16 | static readonly activityDestroyedEvent = 'activityDestroyed';
|
17 | /**
|
18 | * @deprecated Use `Application.android.activityStartedEvent` instead.
|
19 | */
|
20 | static readonly activityStartedEvent = 'activityStarted';
|
21 | /**
|
22 | * @deprecated Use `Application.android.activityPausedEvent` instead.
|
23 | */
|
24 | static readonly activityPausedEvent = 'activityPaused';
|
25 | /**
|
26 | * @deprecated Use `Application.android.activityResumedEvent` instead.
|
27 | */
|
28 | static readonly activityResumedEvent = 'activityResumed';
|
29 | /**
|
30 | * @deprecated Use `Application.android.activityStoppedEvent` instead.
|
31 | */
|
32 | static readonly activityStoppedEvent = 'activityStopped';
|
33 | /**
|
34 | * @deprecated Use `Application.android.saveActivityStateEvent` instead.
|
35 | */
|
36 | static readonly saveActivityStateEvent = 'saveActivityState';
|
37 | /**
|
38 | * @deprecated Use `Application.android.activityResultEvent` instead.
|
39 | */
|
40 | static readonly activityResultEvent = 'activityResult';
|
41 | /**
|
42 | * @deprecated Use `Application.android.activityBackPressedEvent` instead.
|
43 | */
|
44 | static readonly activityBackPressedEvent = 'activityBackPressed';
|
45 | /**
|
46 | * @deprecated Use `Application.android.activityNewIntentEvent` instead.
|
47 | */
|
48 | static readonly activityNewIntentEvent = 'activityNewIntent';
|
49 | /**
|
50 | * @deprecated Use `Application.android.activityRequestPermissionsEvent` instead.
|
51 | */
|
52 | static readonly activityRequestPermissionsEvent = 'activityRequestPermissions';
|
53 |
|
54 | readonly activityCreatedEvent = AndroidApplication.activityCreatedEvent;
|
55 | readonly activityDestroyedEvent = AndroidApplication.activityDestroyedEvent;
|
56 | readonly activityStartedEvent = AndroidApplication.activityStartedEvent;
|
57 | readonly activityPausedEvent = AndroidApplication.activityPausedEvent;
|
58 | readonly activityResumedEvent = AndroidApplication.activityResumedEvent;
|
59 | readonly activityStoppedEvent = AndroidApplication.activityStoppedEvent;
|
60 | readonly saveActivityStateEvent = AndroidApplication.saveActivityStateEvent;
|
61 | readonly activityResultEvent = AndroidApplication.activityResultEvent;
|
62 | readonly activityBackPressedEvent = AndroidApplication.activityBackPressedEvent;
|
63 | readonly activityNewIntentEvent = AndroidApplication.activityNewIntentEvent;
|
64 | readonly activityRequestPermissionsEvent = AndroidApplication.activityRequestPermissionsEvent;
|
65 |
|
66 | getNativeApplication(): android.app.Application;
|
67 |
|
68 | /**
|
69 | * @internal
|
70 | */
|
71 | init(nativeApp: android.app.Application): void;
|
72 |
|
73 | /**
|
74 | * The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
|
75 | */
|
76 | get nativeApp(): android.app.Application;
|
77 |
|
78 | /**
|
79 | * @deprecated Use `Utils.android.getPackageName()` instead.
|
80 | */
|
81 | get packageName(): string;
|
82 |
|
83 | /**
|
84 | * The main (start) Activity for the application.
|
85 | */
|
86 | get startActivity(): androidx.appcompat.app.AppCompatActivity;
|
87 |
|
88 | /**
|
89 | * The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html).
|
90 | *
|
91 | * This property is automatically updated upon Activity events.
|
92 | */
|
93 | get foregroundActivity(): androidx.appcompat.app.AppCompatActivity;
|
94 |
|
95 | /**
|
96 | * @deprecated Use `Utils.android.getApplicationContext()` instead.
|
97 | */
|
98 | get context(): android.content.Context;
|
99 |
|
100 | /**
|
101 | * @deprecated Use `Application.inBackground` instead.
|
102 | */
|
103 | get backgrounded(): boolean;
|
104 |
|
105 | /**
|
106 | * @deprecated Use `Application.suspended` instead.
|
107 | */
|
108 | get paused(): boolean;
|
109 |
|
110 | /**
|
111 | * Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.
|
112 | * For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29'
|
113 | * @param intentFilter A string containing the intent filter.
|
114 | * @param onReceiveCallback A callback function that will be called each time the receiver receives a broadcast.
|
115 | */
|
116 | registerBroadcastReceiver(intentFilter: string, onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void): void;
|
117 |
|
118 | /**
|
119 | * Unregister a previously registered BroadcastReceiver.
|
120 | * For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#unregisterReceiver(android.content.BroadcastReceiver)'
|
121 | * @param intentFilter A string containing the intent filter with which the receiver was originally registered.
|
122 | */
|
123 | unregisterBroadcastReceiver(intentFilter: string): void;
|
124 |
|
125 | /**
|
126 | * Get a registered BroadcastReceiver, then you can get the result code of BroadcastReceiver in onReceiveCallback method.
|
127 | * @param intentFilter A string containing the intent filter.
|
128 | */
|
129 | getRegisteredBroadcastReceiver(intentFilter: string): android.content.BroadcastReceiver;
|
130 |
|
131 | on(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
|
132 | on(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
|
133 | on(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
|
134 | on(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
|
135 | on(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
|
136 | on(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
|
137 | on(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
|
138 | on(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
|
139 | on(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
|
140 | on(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
|
141 | on(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
|
142 | }
|
143 |
|
144 | export class iOSApplication extends ApplicationCommon {
|
145 | /**
|
146 | * The root view controller for the application.
|
147 | */
|
148 | get rootController(): UIViewController;
|
149 |
|
150 | /**
|
151 | * The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
|
152 | */
|
153 | get nativeApp(): UIApplication;
|
154 |
|
155 | /**
|
156 | * The key window.
|
157 | */
|
158 | get window(): UIWindow;
|
159 |
|
160 | /**
|
161 | * The [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
162 | */
|
163 | get delegate(): UIApplicationDelegate & { prototype: UIApplicationDelegate };
|
164 |
|
165 | /**
|
166 | * Sets a custom [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
167 | */
|
168 | set delegate(value: UIApplicationDelegate | unknown);
|
169 |
|
170 | /**
|
171 | * Adds a delegate handler for the specified delegate method name. This method does not replace an existing handler,
|
172 | * but rather adds the new handler to the existing chain of handlers.
|
173 | * @param methodName The name of the delegate method to add a handler for.
|
174 | * @param handler A function that will be called when the specified delegate method is called.
|
175 | */
|
176 | addDelegateHandler<T extends keyof UIApplicationDelegate>(methodName: T, handler: (typeof UIApplicationDelegate.prototype)[T]): void;
|
177 |
|
178 | /**
|
179 | * Adds an observer to the default notification center for the specified notification.
|
180 | * For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
181 | * @param notificationName A string containing the name of the notification.
|
182 | * @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
183 | */
|
184 | addNotificationObserver(notificationName: string, onReceiveCallback: (notification: NSNotification) => void): NotificationObserver;
|
185 |
|
186 | /**
|
187 | * Removes the observer for the specified notification from the default notification center.
|
188 | * For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
189 | * @param observer The observer that was returned from the addNotificationObserver method.
|
190 | * @param notificationName A string containing the name of the notification.
|
191 | * @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
192 | */
|
193 | removeNotificationObserver(observer: any, notificationName: string);
|
194 | }
|