1

How to send Push Notification in Android Hybrid Application using built on Ionic Framework. I am Newbie, Please Guide me Step by Step how to send Push notification in ionic? I saw a different tutorials on youtube and other websites but i am confused where to add those code which shown on these website. I have GCM Project Number (SENDER_ID) but dont know where to put it. Please Guide In details. Thanks in Advance.

2

1 Answer 1

1

Try using phonegap-plugin-push ? It is easy to implement and use.

Config :

    var push = PushNotification.init({
        "android": {
            "senderID": "Your-sender-ID",
            "forceShow": true, // To show notifications on screen as well
            "iconColor": "#403782",
            "badge": "true",
            "clearBadge": "true" // To clear app badge
        },
        "ios": {
            "alert": "true",
            "badge": "true",
            "clearBadge": "true",
            "sound": "true",
            "forceShow": "true"
        },
        "windows": {}
    });

Device Registration :

    push.on('registration', function(data) {
            localStorage.setItem('pushToken', data.registrationId); // Save registration ID
    });

Handle Notifications

    push.on('notification', function(data) {
        console.log(data);
        // Handle all requests here
        if (data.additionalData.$state == "mystate") {
            $state.go('app.conversations');
        }
    })
Sign up to request clarification or add additional context in comments.

1 Comment

That's okay, someone might need this in future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.