-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Uncaught ReferenceError: PushNotification is not defined #271
Comments
Here is the error i got in the command prompt FAILURE: Build failed with an exception.
BUILD FAILED Total time: 6.053 secs C:\Users\anas\newpush\platforms\android\cordova\node_modules\q\q.js:126 |
I encountered this on a computer of one of my colleagues just yesterday,
On Wed, Oct 28, 2015 at 12:52 PM Sulthan Allaudeen notifications@github.com
|
So, i want to install all these ?
|
@bmwsedee It worked after installing all those packages ? |
@sulthanallaudeen yes, those packages are necessary for this plugin to function properly. Once you install them and re-test please close this issue if it is resolved. |
@macdonst Ok thanks, i will update and re-test the mentioned packages and will do it accordingly |
To solve the problem you have simpy to put the code into it's right? :) |
@ste5787 well yeah, if the user is not waiting for $ionicPlatform.ready() or the |
Thanks, I have updated the given packages in Android Studio And i noted that the function is already inside the Still i am facing the error.. What could be the issue ? onDeviceReady: function() { I did the again did the fresh install of project and installed the
Then when i try to run I am still getting the error Here is the Error Trace FAILURE: Build failed with an exception.
BUILD FAILED Total time: 6.228 secs C:\Users\anas\newpush\platforms\android\cordova\node_modules\q\q.js:126 What should i do now ? |
@sulthanallaudeen Just to be sure, but did you install the necessary components in the Android SDK Manager? |
@bmwsedee Yes i have install the necessary components in the Android SDK Manager.. If i remove the plugin and run the project.. the app is getting installed in the Device but I am getting |
Please try this: whit inspector opened write "PushNotification" in the console and than press enter key. What happen? |
@sulthanallaudeen What version of the plugin are you using? Maybe downgrading to 1.3.0 helps (as suggested in #273) or maybe #179 gives any hints? |
@sulthanallaudeen you have to resolve the problem where the dependency Make sure your $ANDROID_HOME environment variable is set correctly. Try opening the project in Android Studio (the platforms/android directory) to see if Android Studio can compile the project. That'll let you know if you've actually got all the dependencies downloaded. |
@macdonst The $A\NDROID_HOME is set correctly. @bmwsedee @ste5787 Can you tell me whether i am doing correctly.
and navigated to example->www-> and copied the files and pasted the www content to the project's www location and i am trying the above steps.. Is that correct way ? Or should i do something else ? |
@ste5787 Now i can't even run the cordova project due to the build error . But can you pls say me whether the steps i followed above was correct ? |
@bmwsedee May i know how to downgrade ? Can you tel me whether the steps i used to do is correct ? Or should i achieve in it some other steps ? |
@sulthanallaudeen Downgrading can be done by removing the existing plugin (phonegap plugin remove phonegap-plugin-push) and installing the plugin with a specific version (phonegap plugin add phonegap-plugin-push@1.3.0). I do however think that @macdonst suggestion of opening the project in Android Studio and see if it compiles there will help you the most; your problem seems to be dependency-related. |
@bmwsedee Thanks, i will follow it.. Can you tel me whether the steps i am doing is correct ?
Is that correct way ? |
@sulthanallaudeen If you want a default implementation for handling notifications you will need steps 2-4, if you just want to know whether you can install the plugin and build your project you will only need to do steps 1 and 5 (supposing step 1 includes the installation of the plugin) |
Yes, I tried 2, 4 .. just wanted to implement the default handling of notifications. I tried that only . |
@sulthanallaudeen oh no, that is not the way you install a plugin into a project. This is what you should be doing:
|
@macdonst Thanks, i followed your instruction and now i can able to run the application and get gcm id. So, i am closing this one. Thanks for the support guys 👍 |
Guys, I still get the same error. although I installed the android SDK components, and follow all the above steps. but nothing has worked for me. PLEASE HELP |
What error you getting ? |
Thank you sulthan, I fixed my problem by adding this code to my config.xml: also, I was debugging in ripple, which will now work unless you debug it on real device. Thank you so much. |
@nadeemkhoury can you share which code you added to your config.xml? I'm still having the same problem |
this code my friend. |
@nadeemkhoury do you have the crosswalk plugin installed on your project? The solution proposed by you doesn't make sense unless you do, as that's a pretty common crosswalk issue. |
hey bro @fredgalvao, No I don't have crosswalk plugin. I think the main problem was debugging using ripple, when I test it on device it works smoothly. but also the code that I had included above has a role in fixing my issue. |
@nadeemkhoury it worked, thanks! |
Make Sure that you include right cordova.js and cordova_plugins.js file. |
Remove ng-app in index.html and put this http://stackoverflow.com/questions/21556090/cordova-angularjs-device-ready. |
I'm using Angular 2 and trying to get this to work.
But even if I wait for |
+1 for me in ionic 2 push plugin v 2.1.3 |
This thread has been automatically locked. |
I am getting
Uncaught ReferenceError: PushNotification is not defined
whenever i run the example..If i install this plugin
cordova plugin add phonegap-plugin-push
or
cordova plugin add https://github.com/phonegap/phonegap-plugin-push
I can't able to run the app itself
This is the line i am getting error
var push = PushNotification.init({
What is the problem and how can i fix this ?
The text was updated successfully, but these errors were encountered: