Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 0508c03

Browse files
Best practice to init firebase #613
1 parent efe14f0 commit 0508c03

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

demo-ng/app/app.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, OnInit } from "@angular/core";
2+
23
const firebase = require("nativescript-plugin-firebase");
34

45
@Component({
@@ -7,13 +8,12 @@ const firebase = require("nativescript-plugin-firebase");
78
})
89

910
export class AppComponent implements OnInit {
10-
1111
ngOnInit(): void {
12-
firebase.init({
13-
persist: false
14-
}).then(() => {
15-
console.log("Firebase initialized");
16-
});
12+
firebase.init(
13+
{
14+
persist: false
15+
})
16+
.then(() => console.log(">>>>> Firebase initialized"))
17+
.catch(err => console.log(">>>>> Firebase init error: " + err));
1718
}
18-
1919
}

src/firebase.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ firebase.init = arg => {
350350
};
351351

352352
try {
353-
if (appModule.android.foregroundActivity) {
353+
if (appModule.android.startActivity) {
354354
runInit();
355355
} else {
356356
// if this is called before application.start() wait for the event to fire

0 commit comments

Comments
 (0)