-1

My requirement is, I need to call a Web-Service and the count of the data should come on the local notification content on daily at 8 AM

example : you have 10 new notification, the 10 is the count of the data in an array.

Some one please help me to do this.

Thanks in advance.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 1
    You cannot do that unless you have a backend that sends push notifications at your required time. With the background fetch you can make iOS do the regular fetch but there is no specific time when the fetch is gonna happen. – Teja Nandamuri May 01 '18 at 12:52
  • Simply you can't! You can see the something similar [question](https://stackoverflow.com/questions/49857236/trigger-local-notifications-automatically-daily-on-dynamic-time-given-in-arrays/). – TheTiger May 01 '18 at 12:54
  • @TheTiger can we call a api when a local notification present time on tapping time is that possible – Manju Sreejith May 01 '18 at 12:57
  • @TejaNandamuri can we call a api when a local notification present time on tapping time is that possible ? am not getting call on the delgates – Manju Sreejith May 01 '18 at 12:58
  • @ManjuSreejith Have you check the link I posted in comment? – TheTiger May 01 '18 at 13:00
  • You can call api only when you tap on local notification, than your local notification delegate method will call. – Pardeep Bishnoi May 01 '18 at 13:00

1 Answers1

0

you cant schedule something like this offline but you have 2 options that differ

  1. with thr app background refresh API you may come close. If you opt in to that api, ios will wakeup your app when it has spare cycles and will give you cpu time to run some code and allow you to do this.

    the background refresh api was meant for 'periodic' updates like this IMO. What you cannot do with it though, is schedule any EXACT times/dates/intervals you want to be woken. You can recommend times to ios but it may or may not stick to the plan (this depends on device use .... battery .... time of day...... etc)

  2. another option are a backend that sends 'silent' push notifications at your required time. IOS would wake your app for those notifications and as they are silent, the user wont see it.

  3. you can have a backend send you non silent pushes. Your app will be launched on tapping the notification and you can do whatever you like

==> option 1 works offline, option 2 and 3 require connectivity and even worse a decdicated backend to support it. IMHO option 1 is often very good and underrated.

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135