why my Ios App is killed by OS in background mode? - ios

hi i have an iOS app that runs perfectly in when i run it through Xcode on my iPhone.when i press the home button and lock the screen, the app keeps recording the data.after 1 or 2 hours when i unlock screen it is still recording data and works perfectly.but when i stop the app , unplug my phone and run the installed app directly through app icon on my iPhone it is killed by the os after a few seconds in lock screen.i have already asked similar question but couldn't find any help.if someone could download the source code and have a look at it it will be very nice of him/her.Thank you

why my Ios App is killed by OS in background mode?
The OS won't allow apps to run for long periods in the background in order to save power. There are exceptions — you can tell the OS that your app needs to run in the background for one of several reasons such as playing music in the background. There are also some facilities for waking up your app in the background to do some processing -- for example, your app can be notified when the location changes.

Related

Chirp Audio QR Fails to receive audio signals on ipad after resuming from background

Chirp audio QR frame work is not receiving data after resuming from background (This issue is only happening on iPAD devices iOS11+)
If the app is in foreground then framework works without having any issues, but if app goes background and then resuming this happens.
Joe from Chirp here. Are you stopping the SDK when moving to the background, and starting again in the foreground?
See our example project at https://github.com/chirp/chirp-ios-examples/blob/master/Swift/Messenger/ChirpMessenger/AppDelegate.swift for an example of this.
I have just tested this on an iPad running iOS 11.4.1 and data is still received when foregrounded.
I you want the app to receive/record audio when it goes into the background state, then Background Audio must be set in the Capabilities plist. Otherwise the OS will remove the microphone connection from your app's process (to allow the new foreground app to possibly use it).

iOS Swift - Prevent OS from killing app in background mode?

I've created an app that takes in bluetooth data from a local device and uploads it to a database. I'd like to be able to keep doing this indefinitely when the app is pushed to the background or if the phone is put into lock/sleep mode.
I've edited Plist info to allow CoreBlueTooth and network content to be enabled while in background mode. Using this and a couple memory saving tweaks for when the app gets pushed into the background, I'm able to hit just under 4 hours of operation when the app is pushed to background and the phone is put to lock/sleep. However, after 4 hours the phone seems to automatically terminate the app completely (while being at over 80% battery life).
Is there any way to prevent iOS from terminating suspended apps and ensure that they run indefinitely (until battery runs out)?
Thanks!

iOS9 reports app background usage when app is not running in the background

We have an app that has UIBackgroundModes set to Audio because it offers streaming of audio inside the app. I have used the app over a period of 6 days and never used the streaming part but still iOS reports the app as having 1 hour of background usage and 3,2 hours on screen.
Is there any reason why the app would continue in the background if the audio is not active? I thought it would only do so if we actually played audio. When testing the app in debugger I don't see any activity after pressing the home button so it seems suspended to me but iOS9 seems to think otherwise.
with the BG mode, your app runs in the BG as long as it isn't killed by the user

Xamarin - iOS backgrounding with BT low Energy and TTS

I'm working on a proof of concept app. I'm using Xamarin for iOS. The iPhone app runs in the background and watches for particular BTLE devices and speaks using TTS when the signal is at a certain strength. I have TTS working and I can recognize the BTLE devices when the app is in the foreground.
However, I'm having trouble getting either working when the iPhone screen is off. In Android, I'd just use a wake lock, but that appears to not be available in iOS. I tried setting the background modes in the info.plist file for BTLE and sound, but I don't see any processing happen while the unit is suspended. Can anyone point me in the right direction?
This is just a proof of concept, so I'm only looking at the latest iOS version and I'm interested in even hacky answers.
Thanks!
You will need to create at least one background task UIApplication.SharedApplication.BeginBackgroundTask and end it with EndBackgroundTask when you finish transferring your data.
Note that you will have approximately 10 minutes in background. If user switch back to the app the time will be reset.
You might also want to disable application idle timer to prevent the screen to go black when the user doesnt touch it.

Launch app from background service

I've developed Android app which has a background service in the sleep mode. This service works with accelerometer data and can launch the app from the sleep mode over the lock screen.
Is it possible to make the same on iOS?
I mean:
Create a service which can work in background with accelerometer data.
Service can launch the app when the phone is in the sleep mode over lock screen. (without unlocking)
If I'm not mistaken it must be possible on iOS7, isn't it?
Thanks!
Yes – Apple publicly stated background processing at WWDC keynote and it can be done to a degree on iOS6
No – Apple will 'probably' never allow an app to be opened without the user instigating it and certainly not over the lock screen.
You could use Push / Local Notifications which do appear on the lock screen to try and entice a user at a specific time to launch the app but no guarantees.

Resources