Pushwoosh / pushwoosh-phonegap-cordova-sample

MIT License
16 stars 29 forks source link

cordova.require fails fresh build #7

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am using phonegap serve command and the phonegap developer app. It just says "connecting to device" and after checking console it just stops on this line: var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");

phonegap plugin list cordova-plugin-console 1.1.0 "Console" pushwoosh-cordova-plugin 7.2.3 "Pushwoosh"

Really want to get this working can anyone help? Thanks Tim

wfhm commented 6 years ago

Hi,

Checking it.

ghost commented 6 years ago

I am in this folder pushwoosh-phonegap-cordova-sample/Phonegap Build I run phonegap serve I view it on my phonegap dev app https://play.google.com/store/apps/details?id=com.adobe.phonegap.app&hl=en_GB It loads app on my phone shows phonegap icon, CONNECTING TO DEVICE flashing and then empty status box.

phonegap plugin list cordova-plugin-console 1.1.0 "Console" cordova-plugin-device 2.0.1 "Device" cordova-plugin-whitelist 1.3.3 "Whitelist" pushwoosh-cordova-plugin 7.2.3 "Pushwoosh"

I dont get it, for some reason its as it it cant find the plugin but I dont know what else to try. Can you talk me through how you working version is setup?

var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");

trevorbest commented 6 years ago

I'm gaving the same issue trying to build for windows mobile, in visual studio when I try to run it immediately exits. The outpus is:

'WWAHost.exe' (Script): Loaded 'Script Code (MSAppHost/3.0)'. Exception is about to be caught by JavaScript library code at line 59, column 13 in ms-appx-web://com.pushwoosh.demoapp/www/cordova.js 0x800a139e - JavaScript runtime error: module pushwoosh-cordova-plugin.PushNotification not found

wfhm commented 6 years ago

@timrabbetts

Phonegap Developer App does not allow using custom plugins, all the plugins available by default you can find following the link below:

http://docs.phonegap.com/references/developer-app/troubleshoot-faq/

To test push notifications using this tool you should create a custom build of your app and upload it to a device (http://docs.phonegap.com/references/developer-app/custom-build/ios). Please note that it does not support Android, therefore you either need to use iPhone or Windows Phone device.

As an alternative solution, you can build an .apk and deploy it on a device using phonegap CLI to test it.

trevorbest commented 6 years ago

The issue I'm having is not with the developer app but with a version built for a Windows device

ghost commented 6 years ago

@wfhm thanks, great to know. doesnt support android? I thought phonegap supported ios, android and others? I am gunna try using cordova and or phonegap command line and building apk and see if that solves problem. think phonegap build and developer app was probably making life difficult for me. Will keep you posted thanks for the hint.

ghost commented 6 years ago

I decided to use the cordova rather than phonegap. Installed andriod studio which sorted allot of the android build issues. Worked fine on android emulator. So the key here is phonegap build and phonegap developer tool dont support custom plugins which would have been nice to know up front. Thanks again for advice.

wfhm commented 6 years ago

@timrabbetts Actually Phonegap Build does support custom plugins and pushwoosh-pgb-plugin in particular. The issue was directly related to Phonegap Developer App.

wfhm commented 6 years ago

@trevorbest Could you please specify whether you get this issue using this sample app or in your own project?

Also, it would be nice if you could provide us with your code that throws this error:

Exception is about to be caught by JavaScript library code at line 59, column 13 in ms-appx-web://com.pushwoosh.demoapp/www/cordova.js 0x800a139e - JavaScript runtime error: module pushwoosh-cordova-plugin.PushNotification not found

Does it happen in onDeviceReady or in onAppActivated?

At last, I have found your thread on StackOverflow:

https://stackoverflow.com/questions/48383807/phonegap-windows-10-published-app-exits-upon-startup

Is it related to this issue?

ghost commented 6 years ago

I didnt raise a thread on slack. It was in the demo app and my custom app. this is the code that failed and the reason was the dev app, running on emulator works fine. var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");

contactwahyu commented 5 years ago

hi i'm experiencing the same issue, seems cordova didn't work at all i'm developing using framework7

if(typeof(cordova) === 'undefined') { app.dialog.alert('Undefined');
};

  var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");

  app.dialog.alert(JSON.stringify(pushwoosh));

they return {}

any ideas?