2017-01-05 9 views
1

ionic2.Iで特定の期間後にリマインダー/アラームを実装しようとしていますが、このプラグインを見つけましたhttps://github.com/wnyc/cordova-plugin-wakeuptimerこれを使用してtypescriptを実装したいのですが、これは認識できませんwindow.wakeuptimer in下記のコード:リマインダー/アラームinイオン性2

window.wakeuptimer.wakeup(successCallback, 
    errorCallback, 

    // a list of alarms to set 

    { 

     alarms : [{ 

      type : 'onetime', 

      time : { hour : 14, minute : 30 }, 

      extra : { message : 'json containing app-specific information to be posted when alarm triggers' }, 

      message : 'Alarm has expired!' 

     }] 

    } 

); 

誰もがこの

答えて

4

で私を助けることができるあなたが使用しようとしているプラ​​グインは、ほぼ3歳。イオン2自体よりも古い。あなたは、私がリマインダ/アラームを処理するためにローカル通知プラグイン(https://ionicframework.com/docs/v2/native/local-notifications/)を使用していた過去にhttps://ionicframework.com/docs/v2/native/

に掲載されているネイティブプラグインをご覧ください。

スケジュール設定は非常に簡単です。通知する時刻のDateオブジェクトを作成するだけです。指定したデータを使用した例を次に示します。

import { LocalNotifications } from 'ionic-native'; 


// Schedule delayed notification 

LocalNotifications.schedule({ 
    text: 'Alarm has expired!', 
    at: new Date(new Date().getTime() + 3600), 
    sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf', 
    data: { message : 'json containing app-specific information to be posted when alarm triggers' } 
});