Ionic2 push notification error with phonegap-plugin-push

Im trying to add push notification to my ionic2 application. Searching on google i found this article:

  • I installed the plugin:
    cordova plugin add phonegap-plugin-push --variable SENDER_ID={SENDER_ID} --save

  • Edit my app.component.ts adding:

import { Push, PushObject, PushOptions } from "@ionic-native/push";
  • But when i call into my constructor:
constructor(public platform:Platform, public push:Push)
  • Typescript returns:

Cannot find name ‘Push’

  • And if i add the initPushNotification method with the same code that the article, example:
const options: PushOptions = {
      android: {
        senderID: "SENDER_ID"
      },
      ios: {
        alert: "true",
        badge: false,
        sound: "true"
      },
      windows: {}
};
  • Typescript returns:

Cannot find name ‘PushOptions’

It’s like typescript not recognize my import:

import { Push, PushObject, PushOptions } from "@ionic-native/push";

Any idea why? Most comments in the article said that works fine!
Thanks!

Well, uh, since you didn’t mention it I have to ask: Did you also npm install @ionic-native/push?

1 Like

LOL. I was thinking that the only thing i had to install was the cordova plugin.

I’m feeling like a noob now :open_mouth:
thank you bro!

1 Like