Suggestions for XDK & Notification

0 favourites
  • 3 posts
From the Asset Store
"Easy Local Notifications" enhances games with customizable local notifications.
  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)