Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

Navigate on receiving pushnotifcation #103

@Habeeb-mohamed

Description

@Habeeb-mohamed

I am able to receive push notification on all time after register.
App is redirecting to particular route based on push notification, when i minimize the app.
But when i kill the app. On tapping push notification message. It is not routing to the routes

I registered for push notification using ..service.ts(angular) on app.component.ts(onNgInit).

ngOnInit() {
        this.pushService.checkAndRegisterPush();
    }

on service i am registering to azure.

var pushPlugin = require("nativescript-push-notifications");
        var that = new WeakRef(this);
        var settings = {
            senderID: "xxxxxxxxxxxxx",
            notificationCallbackAndroid: function (message, pushNotificationObject) {
                console.log(JSON.stringify(pushNotificationObject));
                var pushMessage = JSON.parse(pushNotificationObject);
                if (pushMessage.module && pushMessage.moduleid && pushMessage.foreground === false)
                    that.get().LoadModule(pushMessage.moduleid, pushMessage.module);
            }, badge: true, sound: true, alert: true,
            notificationCallbackIOS: function (message) {
                console.log(JSON.stringify(message));
                if (message.module && message.moduleid && message.foreground === "0")
                    that.get().LoadModule(message.moduleid, message.module);
            }
        };
        console.log("RegisterPushNotification");
        pushPlugin.register(settings, (data) => {
            if (pushPlugin.onMessageReceived) {
                pushPlugin.onMessageReceived(settings.notificationCallbackAndroid);
            }
            console.log(data);
            setString("MobilePushID", data);
            this.registerToAzure(data);
            //setString("tag", "true,true,true");

        }, (e) => { console.log(e); });

In App.component.html contains only Routeroutlet
Default route has some http polling service.
Do i missed any thing?
In some rare instance it is redirecting. Is that related to thread/Delay on registration?

It worked as expected in android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions