OneSignal has worked. I will suggest the XDK builder some important points that I have missed. These may be helpful for every Construct users.
1- Build with "Cordova"
2- Do not delete /js and /xdk folders in /www folder.
3- Add /js/index.js file. Add these lines below:
document.addEventListener('deviceready', function () {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init("CHANGE_WITH_THESE_ONESIGNAL_ID",
{googleProjectNumber: "CHANGE_THIS_WITH_GOOGLE_PROJECT_NUMBER"},
notificationOpenedCallback);
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);
}, false);
4- Go to index.html file in XDK and add these lines below cordova.js script:
<script src="js/app.js"></script>
<script src="xdk/init-dev.js"></script>
This is the common mistake and Construct cannot produce these lines and when you built with Cordova, these lines will be automatically deleted.
5- Add these script under c2runtime.js script
<script src="js/index.js"></script>
6- Add cordova and the other plugins below which are very important (to XDK plugins section)
https://github.com/one-signal/OneSignal ... PGB-Compat
https://github.com/floatinghotpot/google-play-services
https://github.com/floatinghotpot/cordo ... support-v4
That's all.
These setup has worked, I have received notifications and there is no crash!
Hope this will be useful for every Construct family.