1

I need to set notifications daily multiple times. The timings data (which is variable) is being fetched by an API. For this I probably need a background task that will periodically fetch the data for the week/day. That task should obviously run even when the app is closed/terminated because rarely an app is in the foreground/background. But all the libraries/packages (e.g expo's TaskManager/BackgroundFetch, react-native-background-fetch, react-native-background-task etc) I have searched have some limitations e.g. they wouldn't work when an app is terminated (swiped away from the recent apps list) or they wouldn't work for IOS when an app is terminated

I need an all-rounder library that would:

  1. execute background task even when an app is closed
  2. work for android + ios

It is such a common use case but I am unable to find any solution

artsnr
  • 952
  • 1
  • 10
  • 27
  • I haven't tried for it but you must have a try with react-native-background-fetch npm to run background tasks in react native – Jignesh Mayani Jan 27 '21 at 05:41
  • @SilverskyTechnology Re. https://www.npmjs.com/package/react-native-background-fetch/v/2.5.6 It wouldn't work when an app is closed for IOS. How would I cater that on IOS – artsnr Jan 27 '21 at 05:44
  • We cannot make the app work in the background when the app is terminated in ios so it is very difficult to run background task in ios – Jignesh Mayani Jan 27 '21 at 06:03
  • So how to cater the scenario for IOS. How to trigger local notifications for IOS when data is not locally present – artsnr Jan 27 '21 at 06:07
  • Yes, we can schedule notifications for background tasks as if the app is terminated then it is only allowed for 30 seconds to download notifications you can check out the discussion on https://www.quora.com/After-you-kill-the-iOS-application-can-you-run-the-background-tasks or refer to the official Apple docs for better clarifications – Jignesh Mayani Jan 27 '21 at 06:18

0 Answers0