locked
Which backgrounding method should I use? A combination? I have an issue... RRS feed

  • Question

  • User292861 posted

    Hey Xamarin.iOS community, I've been struggling recently with how restrictive backgrounding is on the iOS platform. I started working for a work management company a year ago and am now developing the iOS application, which has a sister Android application, for our ticket management software. In the Android application, all of which was written with Xamarin, my coworker has a process that runs every 5-10 minutes (in the background) that downloads any new tickets and sends any responses that the user may have made back to our server. This allows the user to download a batch of tickets, work on those tickets, and respond to them with or without internet. As soon as they have internet again, be it 3G/4GLTE/WiFi, any new tickets will download and any responses will be sent. As anyone could tell, implementing this on iOS is much harder.

    My main issue is that I need the rigidity of doing this process every 5-10 minutes while the app is running (focused, backgrounded, or suspended -- but still running) and background fetch will not give me such rigidity. This is integral to allowing a field worker to use this app without internet and still get work done. It's conceivable that I write a server-side program to send out push notifications every 5-10 minutes when we receive new tickets that we need to push to the user; however, there are two problems with this approach: lack of internet and the persisting problem of sending responses to our server. If the user does not have internet, the push notifications simply are not going to work. And one can't use push notifications to somehow upload data.

    I understand that Apple does not consider scheduled background tasks as a valid reason to allow background access, so what can I do? Every 5 to 10 minutes, I need to attempt to download any new tickets and then upload any responses to previous tickets, regardless of the state of the app (save for completely terminated). Being able to work on tickets without internet is why the Android application has been such a success for our business, and I really need to do the same with the Apple application. Currently, being able to implement this system on the iOS platform is not foreseeable. Does anyone have any ideas or suggestions?

    Much appreciated.

    Friday, April 21, 2017 3:44 PM

Answers

  • User35208 posted

    @TrevorYokum I think your hands are pretty much tied. You have already looked into what I believe are the only two approaches which is background fetch and silent push notifications. The thing I don't like about background fetch is it seems very unpredictable as to how often iOS wakes up your app. At least with silent push you could have some control over when you do your downloads. I am not so sure that you could not also upload data.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, April 21, 2017 4:47 PM

All replies

  • User35208 posted

    @TrevorYokum I think your hands are pretty much tied. You have already looked into what I believe are the only two approaches which is background fetch and silent push notifications. The thing I don't like about background fetch is it seems very unpredictable as to how often iOS wakes up your app. At least with silent push you could have some control over when you do your downloads. I am not so sure that you could not also upload data.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, April 21, 2017 4:47 PM
  • User292861 posted

    @TedRogers I believe that you are right, though I may have found a slight way around it. I believe that we've decided to include a refresh button on the app, which will give the user some nice feedback and let the user know that they've indeed gotten all of the data/tickets that they needed to get, and that their responses have been sent. We can use location services, which we use to update the user's location for our customers, to cycle. If we can get a location update every X minutes, while we send the location data to the server, we can also send any responses and download any new tickets.

    Tuesday, April 25, 2017 2:22 PM