1
- <!-- vscode-markdown-toc -->
2
- * 1 . [ Intro] ( #Intro )
3
- * 2 . [ Installation] ( #Installation )
4
- * 3 . [ Use @nativescript/firebase-crashlytics ] ( #Usenativescriptfirebase-crashlytics )
5
- * 3.1. [Log a crash context](#Logacrashcontext)
6
- * 3.2. [Set crash attributes for more context data](#Setcrashattributesformorecontextdata)
7
- * 3.3. [Test crashlytics](#Testcrashlytics)
8
- * 3.4. [Report errors manually](#Reporterrorsmanually)
9
- * 3.5. [Manually enable or disable crashlytics collection](#Manuallyenableordisablecrashlyticscollection)
10
- * 4 . [ API] ( #API )
11
- * 4.1. [Crashlytics](#Crashlytics)
12
- * 4.1.1. [Properties](#Properties)
13
- * 4.1.2. [Methods](#Methods)
14
- * 5 . [ License] ( #License )
15
-
16
- <!-- vscode-markdown-toc-config
17
- numbering=true
18
- autoSave=true
19
- /vscode-markdown-toc-config -->
20
- <!-- /vscode-markdown-toc --> # @nativescript/firebase-crashlytics
21
-
22
- ## 1. <a name =' Intro ' ></a >Intro
1
+
2
+ # @nativescript/firebase-crashlytics
3
+
4
+ * [ Intro] ( #Intro )
5
+ * [ Installation] ( #Installation )
6
+ * [ Use @nativescript/firebase-crashlytics ] ( #use-nativescriptfirebase-crashlytics )
7
+ * [Log a crash context](#log-a-crash-context)
8
+ * [Set crash attributes for more context data](#set-crash-attributes-for-more-context-data)
9
+ * [Test crashlytics](#test-crashlytics)
10
+ * [Report errors manually](#report-errors-manually)
11
+ * [Manually enable or disable crashlytics collection](#manually-enable-or-disable-crashlytics-collection
12
+ * [ API] ( #API )
13
+ * [Crashlytics](#Crashlytics)
14
+ * [Properties](#Properties)
15
+ * [Methods](#Methods)
16
+ * [ License] ( #License )
17
+
23
18
24
19
A plugin that allows you to add [ Firebase Crashlytics] ( https://firebase.google.com/docs/crashlytics ) to your NativeScript app.
25
20
@@ -33,17 +28,20 @@ Crashlytics helps you to collect analytics and details about crashes and errors
33
28
34
29
[ ![ image] ( https://img.youtube.com/vi/k_mdNRZzd30/hqdefault.jpg )] ( https://www.youtube.com/watch?v=k_mdNRZzd30 )
35
30
36
- ## 2. <a name =' Installation ' ></a >Installation
31
+
32
+ ## Installation
37
33
38
34
Install the plugin by running the following command in the root directory of your project.
39
35
40
36
``` cli
41
37
npm install @nativescript/firebase-crashlytics
42
38
```
43
39
44
- ## 3. <a name =' Usenativescriptfirebase-crashlytics ' ></a >Use @nativescript/firebase-crashlytics
45
40
46
- ### 3.1. <a name =' Logacrashcontext ' ></a >Log a crash context
41
+ ## Use @nativescript/firebase-crashlytics
42
+
43
+ ### Log a crash context
44
+
47
45
Use the ` log ` method throughout your app to accumulate extra context for possible crashes that can happen.
48
46
49
47
``` ts
@@ -54,7 +52,7 @@ const crashlytics = firebase().crashlytics();
54
52
crashlytics .log (' User signed in.' );
55
53
```
56
54
57
- ### 3.2. < a name = ' Setcrashattributesformorecontextdata ' ></ a > Set crash attributes for more context data
55
+ ### Set crash attributes for more context data
58
56
59
57
For additional context, Crashlytics also offers various methods to set attributes for the crash report.
60
58
@@ -96,15 +94,15 @@ const crashlytics = firebase().crashlytics();
96
94
crashlytics .setUserId (user .uid );
97
95
```
98
96
99
- ### 3.3. < a name = ' Testcrashlytics ' ></ a > Test crashlytics
97
+ ### Test crashlytics
100
98
101
99
To test Crashlytics for your app, call the ` crash ` method to force a crash and in Firebase Console, see if the crash is logged.
102
100
103
101
``` ts
104
102
firebase ().crashlytics ().crash ()
105
103
```
106
104
107
- ### 3.4. < a name = ' Reporterrorsmanually ' ></ a > Report errors manually
105
+ ### Report errors manually
108
106
109
107
Crashlytics also supports sending JavaScript stack traces to the Firebase console. This can be used in any situation where an error occurs but is caught by your code to recover gracefully.
110
108
@@ -127,7 +125,7 @@ try {
127
125
}
128
126
```
129
127
130
- ### 3.5. < a name = ' Manuallyenableordisablecrashlyticscollection ' ></ a > Manually enable or disable crashlytics collection
128
+ ### Manually enable or disable crashlytics collection
131
129
132
130
As Crashlytics will be sending certain information regarding the user, users may want to opt out of the crash reporting. To disable crashlytics collection, call the ` setCrashlyticsCollectionEnabled ` method on ` firebase().crashlytics() ` passing it ` false ` This can be done throughout the app with a simple method call to setCrashlyticsCollectionEnabled:
133
131
@@ -137,19 +135,22 @@ import { firebase } from '@nativescript/firebase-core';
137
135
firebase ().crashlytics ().setCrashlyticsCollectionEnabled (false );
138
136
```
139
137
140
- ## 4. <a name =' API ' ></a >API
141
- ### 4.1. <a name =' Crashlytics ' ></a >Crashlytics
138
+ ## API
139
+
140
+ ### Crashlytics
142
141
143
142
The Crashlytics class has the following members.
144
- #### 4.1.1. <a name =' Properties ' ></a >Properties
143
+
144
+ #### Properties
145
+
145
146
| Property | Type | Description
146
147
|----------|------|------------
147
148
| ` ios ` | | _ readonly_
148
149
| ` android ` | _ readonly_
149
150
| ` app ` | [ FirebaseApp] ( ) | _ readonly_
150
151
152
+ #### Methods
151
153
152
- #### 4.1.2. <a name =' Methods ' ></a >Methods
153
154
| Method | Returns | Description
154
155
|----------|------|------------
155
156
| ` checkForUnsentReports() ` | ` Promise<boolean> `
@@ -164,6 +165,6 @@ The Crashlytics class has the following members.
164
165
| ` setCrashlyticsCollectionEnabled(enabled: boolean) ` | ` void `
165
166
| ` setUserId(userId: string) ` | ` void `
166
167
167
- ## 5. < a name = ' License ' ></ a > License
168
+ ## License
168
169
169
170
Apache License Version 2.0
0 commit comments