Schedule a function to run at a future time with Cordova on Android
<p>I have an ionic app and I'd like to schedule a notification at a later time, and also calling some other function at a later time as well.</p>

<p>What I have now:</p>

<pre><code>    var now = new Date();
    var _10SecondsFromNow = new Date(now.getTime() + (10 * 1000));
    $cordovaLocalNotification.schedule({
      id: 1,
      title: 'Title here',
      text: 'Text here',
      at: _10SecondsFromNow
    }, function(){
      console.log('callback') // never called
    })
    .then(function(){
      console.log('then'); // called right away
    });
</code></pre>

<p>The <code>.then</code> promise runs right away instead of when the notification occurs 10 seconds later. I also noticed in the <a href="https://github.com/katzer/cordova-plugin-local-notifications/wiki/04.-Scheduling#schedule-repeatedly" rel="nofollow">docs</a> that there is a callback you can pass to <code>localNotification</code>, however, it is never called. </p>

<p>I am open to any way to schedule a future task, I am not limited to <code>localNotification</code> from cordova.</p>