Suggestions for XDK & Notification

Discussion and feedback on Construct 2

Post » Tue Jan 19, 2016 12:53 pm

Hi, I have decided to use XDK instead of Ludei. Everythings are ok, but I haven't solved the notification problem. I have tried Cranberrygame's notification plugin (which crashes everytime), Pushbots (trouble with registering device), Onesignal (trouble with sending notifications) and more. However I haven't solved and send any notification to my clients. Any suggestion or better service do you advice?
B
9
S
2
G
3
Posts: 21
Reputation: 2,302

Post » Wed Jan 20, 2016 12:08 am

Hey GameTrick. I'm one of the developers of OneSignal. Sorry to hear you had trouble sending notifications with our service.

Can you tell me more about the issue we encountered? We'd love to help figure out the cause to help get you up and running, and to make sure other developers don't run into any similar issues. You can reply here or get in touch with us at support(at)onesignal.com.
B
3
Posts: 1
Reputation: 177

Post » Wed Jan 20, 2016 8:38 am

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.
B
9
S
2
G
3
Posts: 21
Reputation: 2,302


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests