Window/Cordova.plugins undefined

Thread is closed for posting
3 posts, 0 answers
  1. Carter
    Carter avatar
    3 posts
    Member since:
    Jun 2015

    Posted 31 Mar 2016 Link to this post

     I have an existing Telerik AppBuilder application that previously had working notifications before a major overhaul was done on the app. The app uses Cordova 3.7.0 and is attempting to implement the localnotifications plugin, whose source code can be found here : . I installed it using the instructions specified in Telerik's "Verified Plugins" Documentation. However, it no longer functions. Through various alerts, alert(windows.plugins) and alert(cordova.plugins) is always undefined, as is alert(windows.plugins.notifications) and all permutations thereof. I saw responses to other replies saying that window.plugins would always be undefined and deprecated, but window.plugins.[PLUGIN_NAME] would exist. However, this does not seem to be the case. Below is the code current being used 


    define(['jQuery', 'base64'], function ($, base64) {


    var that = this;
    document.addEventListener("deviceready", function() {
    }, false);



    The previously functioning code was  

                if (that.hasNotificationPlugin()) {
                    that.clearNotifications(function() {
              'Setting notifications');
                        // Schedule notifications for each day from the schedule
                        $.each(data.DeliveryDaysThisWeek, function (i, day) {
                            var dow = day.DayOfWeek;
                            // Schedule notifications for each store within a day
                            $.each(day.Stores, function (i, store) {
                                // Only schedule the notification if the user 
                                // hasn't disabled notifications for this store
                                if (that.get('notification' + store.StoreId) !== 'false') {
                                    var cutoffDate = new Date(store.CutOffDateTime);
                                    var cutoffString = $, 'h:mm a');
                                    // Schedule it 30 minutes before the cutoff time
                                    // or using the user defined time
                                    var time = parseInt(that.get('notificationTime'));
                                    if (isNaN(time)) {
                                        that.set('notificationTime', "30");
                                        time = 30;
                                    var notifDate = new Date(cutoffDate.getTime() - time * 60 * 1000);
                                    // Only schedule it if it's in the future
                                    if (notifDate > new Date()) {
                                            id: (dow * 100000 + store.DeliveryTimes[0].DeliveryTimeId).toString(),
                                            date: notifDate,
                                            message: "The cutoff time is almost up! Place your order by " + cutoffString,
                                            title: store.Store.Restaurant.RestaurantName.trim(),
                                            json: JSON.stringify({StoreId: store.StoreId}),
                                            icon: 'icon'



    that.alert(message) is a shortcut function for navigator.notificaiton.alert(message, false, "COMPANY_NAME") and works fine. 



  2. Carter
    Carter avatar
    3 posts
    Member since:
    Jun 2015

    Posted 31 Mar 2016 in reply to Carter Link to this post


    Cordova or window.plugins.notification breaks the code, and does not stringify to undefined.

  3. Martin
    Martin avatar
    104 posts

    Posted 05 Apr 2016 Link to this post

    Hi Carter,

    The latest release of the plugin (after 0.8.2) introduces a few breaking changes in the API and also requires Cordova 4.0.

    As you have mentioned that you are using 3.7, could you please check which version of the plugin you are using?

    If the plugin version is after 0.8.2, please upgrade your Cordova version to 4.0.

    Let me know if this has worked.


    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top