I am developing an Android App using Phonegap and trying to add the Push Notification. I already added the plugin successfully using "phonegap plugin add phonegap-plugin-push". Config.xml was also updated and i can see the version of push plugin as 2.2.3. Note: i created the project using the push-template. Cordova.js is also coded in index.html.
When i try to view my application on google browser. I get these errors.
- Uncaught ReferenceError: module is not defined at push.js:330
- Uncaught TypeError: PushNotification.init is not a function.
I am not allowed yet to post pictures so here's the link for the section which is having an issue. https://i.stack.imgur.com/ezw6U.png
I've been trying to fix this. Read all related problem on github and stackoverflow but to no avail.
These are the versions i'm using.
- cordova 9.0.0
- phonegap 8.2.2
Solved!
The browser will give you this error if you are previewing your app using the index.html from the root folder of your application.
It should be compiled first to a specific platform so you can preview the app from the compiled files. This is the path in case of Android: platforms\android\app\src\main\assets\www