1

I have a requirement to periodically send back some data from the mobile app to my backend server.

I have written my mobile application in 2 versions: Android and iOS. For the Android version, it's ok since I can schedule a task in the background to send the data. But for iOS, especially the iOS 11, the background process can only live for 10 minutes, means that the data will never be sent back to the server until the app is turned on.

Is there any solution for this? Some event trigger to wake the phone up, no need to be in period.

Vladyslav Matviienko
  • 10,610
  • 4
  • 33
  • 52
xtiger
  • 1,446
  • 2
  • 15
  • 33
  • Simplest possible answer No, You cant. iOS will not allow you to run anything in background forever so scheduling a task to be executed once in every 10 minute is impossible in iOS. You can opt for various background modes to keep your app alive for longer period or better get a chance to be invoked when some specific thing happens (example : if you opt for location your app might be invoked in background by iOS if user moves around or if you use backgroundFetch then your app might get spare time of CPU). Cache the data locally and transfer data to server whenever ur app comes alive – Sandeep Bhandari Jan 22 '18 at 06:11
  • @SandeepBhandari : thanks for the answer, how about the geofencing?, which means when the device is out of some region, the geofencing will be triggered and wake the device up? – xtiger Jan 22 '18 at 06:14
  • Technically yes, depends on whats your distance filter applied ? Which specific API u are using to monitor location changes etc etc. Keep in mind that the API u would use and the way you would use it will decide if Apple will approve your app or not.Usage of all background modes are very strictly monitored during review process. Read: https://stackoverflow.com/questions/43182835/best-way-to-use-background-location-updates-in-ios-swift/43183274#43183274 – Sandeep Bhandari Jan 22 '18 at 06:19
  • question does not relate to Android, since no Android developer can answer it. Removing `android` tag. – Vladyslav Matviienko Jan 22 '18 at 06:40

0 Answers0