Firebase plugin is blocking execution of push notifications plugin


#1

Hi,

I have some code on app.js.
I’m trying to do some logic, when push is set (in this case im sending some additional data “data.link”).
It’s part of push data.
If it’s true, i’m doing redirect to another page.
And this works, but if i include firebase, it’s not working anymore - push is present but this logic will not work.
Does anybody knows why ?
Or there is smarter way of doing logic based on push nature ?
Thanks.

var firebase = require("nativescript-plugin-firebase");

var pushPlugin = require("nativescript-push-notifications");
var iosSettings = {
    badge: true,
    sound: true,
    alert: true,
    senderID: "25841384784892",
    interactiveSettings: {
        actions: [{
            identifier: 'READ_IDENTIFIER',
            title: 'Read',
            activationMode: "foreground",
            destructive: false,
            authenticationRequired: true
        }, {
            identifier: 'CANCEL_IDENTIFIER',
            title: 'Cancel',
            activationMode: "foreground",
            destructive: true,
            authenticationRequired: true
        }],
        categories: [{
            identifier: 'READ_CATEGORY',
            actionsForDefaultContext: ['READ_IDENTIFIER', 'CANCEL_IDENTIFIER'],
            actionsForMinimalContext: ['READ_IDENTIFIER', 'CANCEL_IDENTIFIER']
        }]
    },
    notificationCallbackIOS: function (data) {
        if (data.link) {
            goToPage('arch/all/all')
        }
    }
};

pushPlugin.register(iosSettings, function (data) {
    //alert("Device registered. Access token" + data);

    // Register the interactive settings
    if (iosSettings.interactiveSettings) {
        pushPlugin.registerUserNotificationSettings(function () {
            //alert('Successfully registered for interactive push.');
        }, function (err) {
            //alert('Error registering for interactive push: ' + JSON.stringify(err));
        });
    }
}, function () {
});

#2

Or maybe i’ve done stupid mistake, and mixed 2 plugins for the same thing
Can firebase handle push notifications without push notifications plugin ?


#3

Yes, Push notification is one of the services from firebase. You don’t need push notification plugin when using firebase plugin.


#4

it’s now clear.
Thanks.