Local Notifications when app is not running

You must Login before you can answer or comment on any questions.

App Flow: User performs certain actions. These trigger the app to set local notifications at various times on various dates.

eg: 10:30PM on 15th August, 11:00AM on 19th August, 3:30PM on 26th August.

From what I understand, local notifications will only be displayed when the app is in the foreground or background. The app, needs to be invoked. The background persistent time, is roughly 7 minutes if I am not wrong.

How do I get this to work properly, even when the app hasn't been invoked? Something like iOS's native Clock app which sets Alarms or the Notifications feature from the Things (for iPhone) app.

— asked 11 months ago by Nikhil Nigade
2 Comments
  • Hi Nikhil

    I meant detail out the Things notification example.

    — commented 11 months ago by Malcolm Hollingsworth

  • Ohk, so what happens in Things is this:

    You can setup todos under various categories. Each todo, may or may not have a due date linked to it.

    The notifications bit applies to the ones with a due date. When a todo is due "today" (due date and local date are the same), the user has an option to set up a reminder form the notifications tab, at a suitable time.

    Use case: I have 3 todos due tomorrow, and Things is setup to send me a notification everyday at 11AM. The day on which those 3 todos are due: on that day, at 11AM, I will get a notification about the tasks which I should complete today.

    Even though Things isn't running (foreground or background), it is able to pop a notification for me.

    — commented 11 months ago by Nikhil Nigade

2 Answers

Accepted Answer

Hi Nikhil

There are only three ways that Things can handle notifications;

  • If the app is running - then simply tell you
  • If the app is in the background - then use local notifications
  • If the app is not working - then use push notifications

If the Things app does tell you about events when the app is completely shut down (not in background) then push is the only option for this.

Only Apple apps are able to handle events without the need for local or push notifications.

The Things app has the same restrictions as we do.

— answered 11 months ago by Malcolm Hollingsworth
answer permalink
7 Comments
  • Try a test for me.

    • Set an event for 5 minutes from now.
    • Go to settings and turn on airplane mode.
    • Wait ten minutes
    • Were you alerted?

    Remember to turn back off the airplane mode.

    — commented 11 months ago by Malcolm Hollingsworth

  • Trying this out.

    — commented 11 months ago by Nikhil Nigade

  • This is weird. I tried with this code but nothing happened. Something I did wrong?

    Ti.App.iOS.scheduleLocalNotification({
        alertBody:"Are you sure ?",
        alertAction:"Launch!",
        userInfo:{"Hello":"World"},
        date: (new Date().getTime() + 30000) //set to 30s later
    });

    — commented 11 months ago by Nikhil Nigade

  • Show 4 more comments

Hi Malcom,

I tried this module and turns out, it works perfectly. Highly recommend it.

Ran tests with it to show notifications after 3s, 30s, 3m and 90m. All fired up like fireworks. Cheers to Ben.

Local Notify Module

— answered 11 months ago by Nikhil Nigade
answer permalink
3 Comments
  • Also, I am creating notification in loop. I am adding 10 notfication. But only get 5 notification. Not getting remaining 5 notification.

    Hi, I m struggle with same situation. One simple ques? Suppose, I have set notification for tomorrow at 11 AM. Then close the app. And go to setting date-time, and changed tomorrow and time 10:55 AM. So, after 5 min, can I get notification or not? Currently I am not getting any notification. Can you please help? and share your idea. Many Thanks.

    — commented 4 months ago by Nishant B

  • That should work, in my experience. In the event it doesn't, the module I mentioned above allows you retrive all scheduled notifications. Pull in those, check the current every time the app is run, and update the times if necessary. This is a long shot, but it might work.

    — commented 4 months ago by Nikhil Nigade

  • Cheers for whoever just marked my answer down - makes a guy feel good about helping out.

    — commented 4 months ago by Malcolm Hollingsworth

Your Answer

Think you can help? Login to answer this question!