How does Dropbox Carousel sync when the app is closed and force-quit?
Asked Answered
B

2

6

I've been trying to find information about this but can't seem to find anything. I have a few ideas that I'd like to implement and was hoping that I could do background sync even when app isn't in the app switcher. This Stack Qverflow question seems to say that iOS will not let the app wake up and perform tasks if it was force quit by the user. I gave up on that idea, until now.

I have recently installed Dropbox Carousel and have been using it for automatic photo uploads. I expected that I'd have to open the app every once in a while for the photos to upload to Dropbox. However, with it completely closed (force-quitted), while I was at my computer I noticed files being added to Dropbox.

Somehow, Carousel is uploading photos in the background even if the app is nowhere in the app switcher. How is Dropbox able to do it? Am I missing something?

I've noticed this behaviour intermittently, it isn't like a photo immediately uploads, but at certain intervals a batch get uploaded without opening the app at all and without any action by me (the phone was just connected to WiFi with the screen off).

Brigid answered 14/1, 2015 at 4:14 Comment(1)
They could be using an NSURLSession with background uploadIllfated
H
3

My best guess is Carousel (and all iOS apps with similar background uploading) uses the Significant-Change Location Service to do the background uploading. This service wakes up the app even if it has been terminated (force-quit).

If you leave the significant-change location service running and your iOS app is subsequently suspended or terminated, the service automatically wakes up your app when new location data arrives. At wake-up time, the app is put into the background and you are given a small amount of time (around 10 seconds) to manually restart location services and process the location data.

The Carousel docs drop additional hints that they're using this technique: "significant change in your iPhone's location".

Hygrograph answered 24/2, 2015 at 17:39 Comment(0)
E
2

There are a few ways an App might be able to run in background:

  1. register itself as location-aware App. System would give the App some time to run when you carry your device around and result in location change event.
  2. app can do "background refresh".
  3. app can do "silent content-available" push notification.

The App might be using all of the 3 choices. You can test it out by:

  1. disabling location service: Settings => Privacy => Location Service
  2. disabling background refresh: Settings => General => Background App Refresh
  3. disabling push notification: Settings => Notifications

or simply check whether the App listed in each of the above 3 places.

The App will not be listed in the app switcher if not started by the user explicitly.

Eteocles answered 14/1, 2015 at 6:26 Comment(5)
All your three ways contradict with my linked Stack Overflow question. Nobody seems to have been able to get around iOS not launching an app after it has been force quit. The location aware way MAY be possible, but I highly doubt that it would get approved since the Dropbox Carousel app has nothing to do with location. The other two are two situations in which that other answer says will NOT work for sure.Brigid
For "background refresh" and "silent push", iOS will not re-launch the App if force-quit. However, for #1 "location service", there are a number of ways to make it happen. This is documented clearly by Apple. The following location service will enable App to be re-launched: (1) significant location change, (2) region monitoring service; (3) visit service. The main Dropbox App uses Location Service for background uploading. (Check Settings => Camera Upload)Eteocles
Do you have Dropbox App on your device and enable "background uploading"? If so, I am guessing the photos must have been uploaded by Dropbox App, not the Carousel. Since both Apps are from the same vendor, they can share some data via "App group". (Certainly the Carousel App do have access to local photos, and can file requests to Dropbox server for remote photos.)Eteocles
Yeah, I thought about the Dropbox app possibility, but I checked that the Dropbox app was quit completely as well. I cannot find any references to using the location trick to get around this behaviour, could you post a link? Either way, I don't believe Apple would approve apps that register as a location app and don't actually use the location for normal purposes, similar to how it won't approve any non-VoIP app to use a background persistent connection. Also, I checked, neither Dropbox or Carousel requested location and neither show up in settings under Privacy > Location. So that isn't it.Brigid
Here is what I found: (1) delete Dropbox Carousel App, only leave Dropbox App. In this case, Dropbox App is using Location service for background uploading (checking it in its Settings). (2) install both Dropbox Carousel and Drop App. In this case, the Dropbox UI is changed and simply says "using Carousel for photo uploading". Based on my own testing, if I force quit both Carousel App and Dropbox App, photos are not uploaded no matter where I go. So in case (2), I guess Carousel might have been used background refresh. So there is no mystery here.Eteocles

© 2022 - 2024 — McMap. All rights reserved.