How can I use the Parse push plug-in in an Ionic 2 application?

I’m trying to use the Parse push plugin with my Ionic 2 app from:

Once downloaded it says that it’s ready to use anywhere in my code with the ParsePushPlugin name space. When I try to use it without importing it throws the error:

Cannot find name ‘ParsePushPlugin’.

Upon doing either of the following in the terminal:

cordova plugin add


ionic plugin add

The result is deposited in my ‘plugins’ directory. This is not part of Ionic native so I can’t just import from Ionic Native. I have also tried importing it from the plugins directory using the ParsePushPlugin name space both with and without curly brackets but that does not working either. Where am I going wrong?

UPDATEI updated my package.json based on an inquiry and as of this package.json along with a full re-start the app still says that cordova is not defined.

  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "@types/parse": "^1.2.32",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "underscore": "^1.8.3",
    "moment": "2.10.3",
    "sweetalert": "1.1.3",
    "zone.js": "0.6.26"
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  "cordovaPlugins": [
  "cordovaPlatforms": [
      "platform": "ios",
      "version": "",
      "locator": "ios"
  "description": "CPM: An Ionic project"


declare var cordova:any;

and use like this:

    () => {
        console.log("MyApp::constructor platform.ready");
        cordova.plugins.ParsePushPlugin.// settings and methods.

Check this answer

Note: Cordova plugins do not work with ionic serve as they are not loaded to the browser. You will need to test in a phone.

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » How can I use the Parse push plug-in in an Ionic 2 application?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录