You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use this method with the `JSON.stringify()` (as shown in the `saveObjectAsString` method in the StackBlitz demo app at the link above) to store an object or an array as a string. Then, use `JSON.parse()` to convert the result of [getString()](#getstring) back to the object or array.
21
22
:::
@@ -25,15 +26,15 @@ You can use this method with the `JSON.stringify()` (as shown in the `saveObject
25
26
To store a boolean value, call the [setBoolean](#setboolean) method passing the key as the first argument and the value as second argument.
For system intent filters, see [Standard Broadcast Actions](https://developer.android.com/reference/android/content/Intent#standard-broadcast-actions).
34
39
35
40
### Unregister a broadcast receiver
36
41
37
42
To unregister a broadcast receiver, call the [unregisterBroadcastReceiver](#unregisterbroadcastreceiver) on the wrapper around an [android.app.Application](https://developer.android.com/reference/android/app/Application) passing it the intent filter for which to unregister the broacast receiver. The example below unregisters a broadcast receiver for the `android.content.Intent.ACTION_BATTERY_CHANGED` intent filter.
2. Get the wrapper object for [UIApplication](https://developer.apple.com/documentation/uikit/uiapplication?language=objc) instance.
60
-
```ts
61
-
const iOSApp:iOSApplication=Application.ios
62
-
```
66
+
67
+
```ts
68
+
const iOSApp:iOSApplication=Application.ios
69
+
```
63
70
64
71
3. Call the `addNotificationObserver` method.
65
-
Call the `addNotificationObserver` passing it the name of the notification([NSNotificationName](https://developer.apple.com/documentation/foundation/nsnotificationname)) you would like to observe as the first parameter and as a second parameter, a callback function to be called when that notification occurs.
72
+
Call the `addNotificationObserver` passing it the name of the notification([NSNotificationName](https://developer.apple.com/documentation/foundation/nsnotificationname)) you would like to observe as the first parameter and as a second parameter, a callback function to be called when that notification occurs.
Find the complete example [here](https://stackblitz.com/edit/nativescript-stackblitz-templates-khnhes?file=app%2Fapp.ts%3AL14)
77
84
@@ -80,11 +87,14 @@ Find the complete example [here](https://stackblitz.com/edit/nativescript-stackb
80
87
To remove a notification observer, use the `removeNotificationObserver` method on a `Application.ios` reference the observer id, returned by the `addNotificationObserver` as the first argument and the name of the notification to stop observing.
Loads immediately the app.css. By default the app.css file is loaded shortly after "loaded". For the Android snapshot the CSS can be parsed during the snapshot generation, as the CSS does not depend on runtime APIs, and loadAppCss will be called explicitly.
146
171
147
172
---
173
+
148
174
## addCss()
175
+
149
176
```ts
150
177
Application.addCss(cssText, attributeScoped)
151
178
```
179
+
152
180
Adds new values to the application styles.
181
+
153
182
-`cssText` - A valid CSS styles to be add to the current application styles.
154
183
-_Optional_: `attributeScoped` - sets whether the styles are attribute scoped. Adding attribute scoped styles does not perform a full application styling refresh.
155
-
184
+
156
185
---
157
186
158
187
## Android Reference
@@ -171,15 +200,14 @@ The property gives you the `AndroidApplication` object, a Nativescript wrapper,
For Android, it is the [android.app.Application](http://developer.android.com/reference/android/app/Application.html) instance keeping track of the global application state. From this object you can get methods such as getFilesDir(), onLowMemory(),etc.
181
210
182
-
183
211
For iOS, it returns the reference to a [UIApplication](https://developer.apple.com/documentation/uikit/uiapplication?language=objc) instance for the application.
184
212
185
213
---
@@ -258,10 +286,10 @@ Unregisters a previously registered BroadcastReceiver for the specified intent f
258
286
259
287
### Android Activity lifecycles events
260
288
261
-
To handle the application lifecycle events for Android, use `on` method of the
289
+
To handle the application lifecycle events for Android, use `on` method of the
0 commit comments