-2

I'm making an alarm with UILocalNotification, if first time alarm action is not taken, it snooze again after 5 mins, if not action taken then it snooze again after 5 mins and then I need to send some data in web server, how to implement this?

I can't handle app or take any action when it is not in foreground, is there any other way parallel of broadcasting receiver in iOS?

halfer
  • 19,824
  • 17
  • 99
  • 186
Sabrina Tuli
  • 160
  • 7

1 Answers1

0

Try the approach of always scheduling the connection to the webserver in 10 min with a NSTimer and then discarding it on interaction of any of your local notifications. You could e.g. keep a flag in the app delegate. See BackgroundExecution

You have only 10 min of non-externally triggered background execution - which would be enough for you. There are some workarounds, which you can find here: enter link description here

Schedule local notifications as described here UILocalNotifications in 5 and 10 min. Handle the opening via local notification in your app delegate and discard

Community
  • 1
  • 1
MarkHim
  • 5,686
  • 5
  • 32
  • 64
  • i need to check in background is UILocalNotification arrived, if notification is not shown, then i need to trigger another notification after 5 min, so i need to always check if any local notification arrived in background and then send data to web server from background. I can handle all these if i see the notification from didReceiveLocalNotification method, when i dont see how to do all these? can you provide me code please? @MarkHim – Sabrina Tuli Mar 20 '15 at 10:20