Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Uncaught (in promise): Error: Push plugin not found! #1407

Closed
MELAS007 opened this issue Nov 24, 2016 · 7 comments
Closed

Uncaught (in promise): Error: Push plugin not found! #1407

MELAS007 opened this issue Nov 24, 2016 · 7 comments

Comments

@MELAS007
Copy link

@macdonst

Expected Behaviour

Notification will only arrive in notification drawer when app will be in background or is open.

Actual Behaviour

Nothing

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

SAMSUNG NOTE 3

Cordova CLI version and cordova platform version

cordova --version    6.4.0
cordova platform version android        6.0.0

Plugin version

Ionic Framework: 2.0.0-rc.3

Ionic Native: 2.2.3
Ionic App Scripts: 0.0.45
Angular Core: 2.1.1
Angular Compiler CLI: 2.1.1
Node: 6.9.1
cordova plugin version | phonegap-plugin-push 2.0.0 "PushPlugin"

Sample Push Data Payload

const cloudSettings: CloudSettings = {
  'core': {
    'app_id': 'xxxxxx'
  },
  'push': {
    'sender_id': 'xxxxxxxxxx',
    'pluginConfig': {
      'ios': {
        'badge': true,
        'sound': true
      },
      'android': {
        'iconColor': '#343434'
      }
    }
  }
};

    this.push.register().then((t: PushToken) => {
  return this.push.saveToken(t);
}).then((t: PushToken) => {
  console.log('Token saved:', t.token);
});

this.push.rx.notification()
  .subscribe((msg) => {
    alert(msg.title + ': ' + msg.text);
  });

Logs taken while reproducing problem

in chrome:

Runtime Error
Uncaught (in promise): Error: Push plugin not found! See logs.
Stack
Error: Uncaught (in promise): Error: Push plugin not found! See logs.
    at s (http://localhost:8100/build/polyfills.js:3:8568)
    at s (http://localhost:8100/build/polyfills.js:3:8391)
    at http://localhost:8100/build/polyfills.js:3:8902
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:14051)
    at Object.onInvokeTask (\D:\Mobile_apps\test\pushtest\node_modules\@angular\core\src\zone\ng_zone.js:229:37)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:13987)
    at e.runTask (http://localhost:8100/build/polyfills.js:3:11411)
    at i (http://localhost:8100/build/polyfills.js:3:8028)

on ionic run android:
Nothing appears as error and don't receive any notification...

@macdonst
Copy link
Member

@MELAS007 have you tried asking Ionic?

@vksgautam1
Copy link

i am also getting same error. is there any solution of this ?

@borodiliz
Copy link

I have solved this problem thanks to this comment

@MELAS007
Copy link
Author

MELAS007 commented Jan 18, 2017 via email

@borodiliz
Copy link

@MELAS007

My problem:
In my case the problem was only when I built using the Ionic Package Cloud Service (not building locally with ionic build command)
The reason was that Ionic Package Cloud Service was not including the phonegap-plugin-push plugin to my .apk

The solution:

  1. Remove phonegap-plugin-push from config.xml file
  2. Add those information to the cordovaPlugins section on the package.json file (see diff below)
  3. Build again using the Ionic Package Cloud Service ionic package build android --profile <your profile>

My diff:

diff --git a/config.xml b/config.xml
index 21f7944..4e116fb 100644
--- a/config.xml
+++ b/config.xml
@@ -87,9 +87,6 @@
   <plugin name="cordova-plugin-statusbar" spec="2.2.1"/>
   <plugin name="cordova-plugin-splashscreen" spec="~4.0.1"/>
   <plugin name="cordova-sqlite-storage" spec="~2.0.1"/>
-  <plugin name="phonegap-plugin-push" spec="~1.9.2">
-    <variable name="SENDER_ID" value="<YOUR_SENDER_ID>"/>
-  </plugin>
   <plugin name="cordova-plugin-device" spec="~1.1.4"/>
   <icon src="resources/android/icon/drawable-xhdpi-icon.png"/>
 </widget>
\ No newline at end of file
diff --git a/package.json b/package.json
index 77c38e2..3098c7c 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,13 @@
     "cordova-plugin-statusbar",
     "cordova-plugin-device",
     "cordova-plugin-splashscreen",
-    "ionic-plugin-keyboard"
+    "ionic-plugin-keyboard",
+    {
+      "variables": {
+        "SENDER_ID": "<YOUR_SENDER_ID>"
+      },
+      "locator": "phonegap-plugin-push"
+    }
   ],
   "cordovaPlatforms": [],
   "description": "myApp: An Ionic project"

@macdonst
Copy link
Member

@borodiliz thanks, added to docs.

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants