Pushwoosh - push notification

Hi
This is probably a silly question, but I need to make sure, do we need to include cordova.js in index.html?

<script type=“text/javascript” src=“cordova.js”></script>

I’m building using Framework7 and it seems has different way to handle anything.
I put these following code in app.js

$$(document).on(‘DOMContentLoaded’, function(){
app.dialog.alert(‘Device Ready!’);
var pushwoosh = cordova.require(“pushwoosh-cordova-plugin.PushNotification”);
// Should be called before pushwoosh.onDeviceReady
document.addEventListener(‘push-notification’, function(event) {
var notification = event.notification;
// handle push open here
app.dialog.alert(‘Hello!’);
});
// Initialize Pushwoosh. This will trigger all pending push notifications on start.
pushwoosh.onDeviceReady({
appid: “XXXXX-XXXXX”,
projectid: “xxxxxxxxxxx”,
serviceName: “MPNS_SERVICE_NAME”
});
});

However, it just only display “Device Ready!” and nothing after that. Any ideas would be highly appreciated…
Thanks.

If you use it in Cordova app then, of course, you must have a script linked to cordova.js in app’s index.html file.
And i guess DOMContentLoaded must be replaced with deviceready event.

it’s deviceready before which is not working. by changing to DOMContentLoaded, the deviceready is firing and the dialog can appear. Even I include cordova.js, the pushwoosh script seems not working. fyi, I have installed the plugin already.

1 Like

And all your scripts in the very end of body in index.html? Do you see any errors in console?

no, my script in app.js. in index.html only attaching cordova.js
once i run without attaching cordova.js, it came up with “cordova is not found” error, so i suppose we need to attach cordova.js file. other than that, the script is just not running.

hi
do we need to bother to copy cordova.js to www folder or just attach it in index.html, ignoring the location of the file?

1 Like

@centinel Did you fix this, am having issues with cordova.js not displaying onesignal push notifications.

We tested a raw cordova installation without framework7 it work perfectly, but we tried it on framework7
the notification does not display.

Am using framework7 core with cordova.

Why the cordovaapp.js?

it seems to block the push notifications from entering.