This question already has answers here:
Continue uploading process in background IOS
(4 answers)
Closed 5 years ago.
in my application user can upload a file, but if he lock his phone, it stops uploading. Is there any way to upload or download when the phone is locked ?
This is by design. Apple does not want iOS apps to run in the background as they might drain the battery.
But Apple has added many APIs so iOS can take over the background task on behalf of the app. And uploading and downloading is one of these tasks.
Have a look at NSURLSession and in particular at NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:. This is how it's done.
So with the way iOS works, Apple pauses background applications when the device is locked. You'll have to use specific API calls to allow your app to continue working in background, such as beginBackgroundTaskWithExpirationHandler
Related
I'm developing a medical alert and record keeping app for iOS for a client. The app needs to be able to open itself at specific times based on a schedule that is set remotely.
I've searched around for how this can be done, and I keep running into other apps that let you schedule app launch times, but this needs to be a self contained solution.
I'd rather not JailBreak the iOS device to make it work, and I've come across articles that say iOS 9+ now has this capacity, but no instructions on how to make it come about.
Any clues, tutorials, or other information on how to accomplish this?
You can use "silent" push notifications (with "content-available") on iOS 7+ to launch the app when the push notification is received on the device. You will get a chance to process the notification, and the app will be launched if it's not already running.
However, it still won't work if the user has force killed the app.
Also, iOS will not launch your app if it feels you've gone over the daily processing time or data quota.
Am trying a simple Apple Watch App. the question I have is : will the iPhone App be able to run always in the background? In the App, I want to fetch some files from a server & store them in the iPhone (I want to do this everyday at a specific time), so that when the user opens the Apple Watch App, the file can be showed immediately (and no need to wait for it be downloaded then).
You can run tasks in the background of an iPhone application yes. I have no idea about how this interacts with the Apple Watch (your post suggests this will just sync automatically perhaps). Good point of reading:
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
This question already has answers here:
Will iOS region monitoring call didEnterRegion on my app if my app is in a terminated state?
(2 answers)
Closed 8 years ago.
I'm creating a location aware application. I was able to create geofences already,
when I test it in my iPhone, I noticed that the calllback methods -didEnterRegion and -didExitRegion are being called when the application is running in foreground and background. But when I killed the application (meaning the application state is "not running") the said method call backs are not being called.
So, what am I missing here? Is there any configuration that I need to do? Any thought guys? Thank you!
This is correct behaviour depending on how you 'killed' the app. If you stopped the app by swiping up from the multi-tasking view (double tap home) then iOS 7 interprets this as meaning you do not want the app to operate at all - either in the foreground or background. If the app is 'killed' as a result of being in the background when the device needs more memory then it will continue to operate in background mode.
Refer to this answer - Region monitoring in ios 7
In order to test you can stop your application using Xcode, simulate a low-memory situation while your app is suspended or call exit() for testing purposes.
I am using phonegap 2.2.0 to develop an ios app. The app requires to download some videos which i'm doing with the FileTransfer. The problem is if the app goes background i.e if the screen is locked or if the home key is pressed, download gets cancelled. I need to continue downloading the videos even when the app is in background. Is there any workaround for this?
The problem is that your app gets suspended after a short period of being in background mode, so it is no longer executing code. You need to either declare and implement your app as a service (UIBackgroundModes in Info.plist), or delay the suspension (in applicationDidEnterBackground handler). Both cases are tricky if you are a pure PhoneGap developer.
I wrote a small PhoneGap plugin for iOS that checks whether the app has called for background mode, and if so prevents it from getting suspended (normally up to 10 minutes) until the mode is revoked.
See this article for more detail.
I need to create an app which can handle movement events while running on the background.
i.e each time an accelerometer event is happening it should be tracked in the application memory-when the application is running in the background.
My questions are :
1. Is it possible on IOS?
2. How can it be done?
(I came up with some relevant questions but i'm not sure that the answers are up to date due to IOS changes.)
Thanks,
Asaf
You should have a look to this thread (and the links inside) and the apple documentation.
To summarize no third party apps can run in the background (even though some of apple apps do this) excepting for:
Tracking the User’s Location
Playing Background Audio
Implementing a VoIP App
Downloading Newsstand Content in the Background
Communicating With an External Accessory