2016-03-31 12 views
0

私は、以前に働いていたTelerik AppBuilderアプリケーションを持っていました。このアプリはCordova 3.7.0を使用しており、ソースコードがhttps://github.com/katzer/cordova-plugin-local-notificationsであるlocalnotificationsプラグインを実装しようとしています。 Telerikの「Verified Plugins」ドキュメントで指定されている手順を使用してインストールしました。しかし、それはもはや機能しません。アラート(windows.plugins)と警告(cordova.plugins)は、アラート(Windows.plugins.notifications)とそのすべての順列と同様に、さまざまなアラートによって常に未定義です。 window.pluginsは常に定義されておらず、廃止予定ですが、window.plugins。[PLUGIN_NAME]は存在すると言っています。しかし、これは事実ではないようで、これは代わりにjavascriptを破壊します。以下のコードの電流がCordova/Window.plugins undefined

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

.... 

var that = this; 
that.alert("starting"); 
document.addEventListener("deviceready", function() { 
that.alert(JSON.stringify(window.plugins)); 
}, false); 

.... 

} 

に使用されている、以前に機能コードた

 if (that.hasNotificationPlugin()) { 
      that.clearNotifications(function() { 
       console.info('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 = $.format.date(cutoffDate, '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()) { 
           window.plugin.notification.local.add({ 
            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(メッセージ)navigator.notificaiton.alertのショートカット機能がある(メッセージ、偽、 "COMPANY_NAME" )うまく動作します。

答えて