MCPcopy Create free account
hub / github.com/NativeScript/firebase / Crashlytics

Class Crashlytics

packages/firebase-crashlytics/index.android.ts:19–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17});
18
19export class Crashlytics implements ICrashlytics {
20 _native: com.google.firebase.crashlytics.FirebaseCrashlytics;
21 constructor() {
22 if (defaultCrashlytics) {
23 return defaultCrashlytics;
24 }
25 defaultCrashlytics = this;
26 }
27 get native() {
28 if (!this._native) {
29 this._native = com.google.firebase.crashlytics.FirebaseCrashlytics.getInstance();
30 }
31 return this._native;
32 }
33 get android() {
34 return this.native;
35 }
36 _app: FirebaseApp;
37 get app(): FirebaseApp {
38 if (!this._app) {
39 // @ts-ignore
40 this._app = FirebaseApp.fromNative(this.native.app);
41 }
42 return this._app;
43 }
44
45 checkForUnsentReports(): Promise<boolean> {
46 return new Promise((resolve, reject) => {
47 NSCrashlyticsReference().checkForUnsentReports(
48 this.native,
49 new org.nativescript.firebase.crashlytics.FirebaseCrashlytics.Callback({
50 onSuccess(param0) {
51 resolve(param0 as any);
52 },
53 onError(param0) {
54 const err = FirebaseError.fromNative(param0);
55 reject(err);
56 },
57 })
58 );
59 });
60 }
61 crash(): void {
62 NSCrashlyticsReference().crash();
63 }
64 deleteUnsentReports() {
65 this.native.deleteUnsentReports();
66 }
67 didCrashOnPreviousExecution(): boolean {
68 return this.native.didCrashOnPreviousExecution();
69 }
70 log(message: string): void {
71 this.native.log(message);
72 }
73 recordError(error: any): void {
74 if (error instanceof Error) {
75 StackTrace.fromError(error).then((stack) => {
76 const traceElements = Array.create('java.lang.StackTraceElement', stack.length);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…