Daniel Hutton
Daniel Hutton

Reputation: 1455

Using Push in Ionic 2

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.

Upvotes: 1

Views: 3223

Answers (2)

Jack Vial
Jack Vial

Reputation: 2474

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.

Upvotes: 0

Victor Carvalho
Victor Carvalho

Reputation: 2020

You import Push from 'ionic-native'?

import {Push} from 'ionic-native';

Upvotes: 2

Related Questions