0

Is it possible to build an ios app that forwards local notifications to the user, each of which is preceded by a remote HTTP call that determines the notification content? (notifications must be issued when the app UI is closed).

valtMorris
  • 13
  • 5
  • The requirement is to shows alerts at scheduled times. But the alert content (the message to show) must be retrieved by a HTTP call (because it is not known at the time the alert is scheduled). I would like to avoid (if possible) to use an external server for push notifications. – valtMorris Apr 22 '14 at 19:53

1 Answers1

0

Only if your app is running is some kind of background mode... like downloading a newsstand issue for example. If not your app is just in memory but "paused"

user2387149
  • 1,219
  • 16
  • 28
  • So a local notification -as is- can only display content, without dinamically calculate it? Are you talking about "Long-Running Background Tasks"? – valtMorris Apr 22 '14 at 19:32
  • How do you make the connection from user2387149's answer to assume content can't be dynamically calculated? Of course it can be dynamically calculated. What you can't do is make the HTTP connection nor post the local notification unless you can execute in the background. To execute in the background your app must use a background mode and you must have a valid reason for using the background mode, wanting to execute in the background is not of itself a valid reason for having a background mode. – Gruntcakes Apr 22 '14 at 19:51
  • Please excuse my possible inaccuracies (@MartinH), but I'm still not a iOS developer and I could not take it for granted assumptions that are trivial for you guys. From the conceptual point of view, I'm talking about the ability to set up a scheduled task (i.e. every day at 19.00) that makes an HTTP call, and show the result in a notice (which I assumed to be a local notification, because at the scheduled time the app UI will not be running). Do you see some impossibility to implement this type of solution in the ios' architecture? – valtMorris Apr 22 '14 at 20:31
  • Regarding the background mode and the justified "valid reason" for its use, the documentation talks about "Apps That need to download new content and process Regularly". Do you think my situation is attributable to this? – valtMorris Apr 22 '14 at 20:32
  • You could probably qualify for "background fetch" as you have new content to process. But you can't schedule a *specific time* with that or any other mechanism, all you can do with background fetch is tell the OS you want to run frequently (or not), but if/when/how often you get run by the OS you have no control over. – Gruntcakes Apr 22 '14 at 22:25
  • _"...At appropriate times, the system gives background execution time to the apps..." "...Only apps that provide important services to the user are allowed..."_ To determine the feasibility of using "background fetch" I need to know 2 things, because Apple documentation seems to be quite generic here: 1) Is there a time threshold (explicitly specified or empirical) within which the system passes control to the app in the background? (I could tolerate a 5-min interval) 2) Does anyone can apply for "background fetch" permission? – valtMorris Apr 23 '14 at 13:00