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

Commit e372679

Browse files
Merge pull request #1071 from cerireyhan/master
Register FirebasePluginLifecycleCallbacks on app-launch
2 parents 3f950ae + 0e0917c commit e372679

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/firebase.android.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ const dynamicLinksEnabled = lazy(() => typeof (com.google.firebase.dynamiclinks)
4343
(() => {
4444
// note that this means we need to 'require()' the plugin before the app is loaded
4545
appModule.on(appModule.launchEvent, args => {
46+
if (messagingEnabled()) {
47+
firebaseMessaging.onAppModuleLaunchEvent(args);
48+
}
4649
if (dynamicLinksEnabled()) {
4750
// let's see if this is part of an email-link authentication flow
4851
const emailLink = "" + args.android.getData();

src/messaging/messaging.android.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ export function initFirebaseMessaging(options?: MessagingOptions) {
4545
}
4646
}
4747

48-
export function onAppModuleResumeEvent(args: any) {
48+
export function onAppModuleLaunchEvent(args: any) {
4949
org.nativescript.plugins.firebase.FirebasePluginLifecycleCallbacks.registerCallbacks(appModule.android.nativeApp);
50+
}
5051

52+
export function onAppModuleResumeEvent(args: any) {
5153
const intent = args.android.getIntent();
5254
const extras = intent.getExtras();
5355

src/messaging/messaging.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export declare function areNotificationsEnabled(): boolean;
2929
export declare const onTokenRefreshNotification: (token: string) => void;
3030

3131
// android. ...
32+
export declare function onAppModuleLaunchEvent(intent: any): void;
3233
export declare function onAppModuleResumeEvent(intent: any): void;
3334

3435
export declare class IosInteractivePushSettings {

0 commit comments

Comments
 (0)