1

I'm trying to implement Push Notifications into an Ionic 2 app using the official documentation.

I have included the phonegap-plugin-push plugin, but when I insert the code they give you (wrapped in a platform ready function), like so:

this.platform.ready().then(() => {
     var push = Push.init({
       android: {
           senderID: "12345679"
       },
       ios: {
           alert: "true",
           badge: true,
           sound: 'false'
       },
       windows: {}
    });

});

I just get the following error:

ORIGINAL EXCEPTION: ReferenceError: Push is not defined

Is there something else I need to do or is it not yet possible to use Push inside an Ionic 2 app?

Thanks for any help.

2
  • I just used PushNotification in the end as per the github.com/phonegap/phonegap-plugin-push docs. Commented Mar 1, 2016 at 15:20
  • How did you achive push notification can you give some explaination or step by step process to do it Commented Sep 10, 2016 at 4:51

2 Answers 2

2

You import Push from 'ionic-native'?

import {Push} from 'ionic-native';
Sign up to request clarification or add additional context in comments.

2 Comments

Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
I found the answer pretty much perfect.
0

For push notifications in Ionic 2 you first need to setup Ionic Cloud: There is a guide here: https://docs.ionic.io/setup.html

Then you need to setup push notifications: https://docs.ionic.io/services/push/

The docs you linked to appear to be out of date.

Comments

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.