iOS External Accessory Disconnects when Application goes to Background - ios

I have an external accessory. It seems like it disconnects when the application goes to the background. Is there any way to fix that?

In your application plist file add following flag
"Required background modes" = "App communicates with an accessory"
This solution works only for iOS 5 and grater version.

If the External Accessory background mode string has not been added in the Info.plist, the app will not get any background running time. (See the iOS App Programming Guide)
If the background mode item is added, you can respond to incoming bytes of a connected accessory.
No timer is available in background mode. They would just not fire when timing out. So you need to figure out what is needed and send requests from MFi device to the iOS if you need polling.

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).

Total screen unlock time calculation in iOS

For my current project, I need to calculate the total time while an iOS device is unlocked i.e. the user is working on his device. I am aware of the Darwin Notifications as available in CFNotificationCenter as specified in this Stackoverflow question. I have tested this code on my iPhone 5C. It is woking fine for foreground mode. But I am not able to receive those notification when the application is in background mode. Is it possible to receive those notification in background mode? Or is there any other way to calculate total unlocked time for a device from my app even when the application is in background mode?
As explained here. Background mode can only be used for specific purposes. If your App is not using background mode for any of those purposes (which it isn't), it will not work.
In short, it could only work on a jailbroken device.

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.

Background App Refresh checking, enabling and disabling programmatically for whole device and for each particular application in iOS 7

We can check Background App Refresh for whole device and for each particular application in iOS 7 manually from settings.
Is there any way to do it programmatically in iOS 7?
The short answer is no you can't check to see what every app's Background Refresh setting is due to application sandboxing. An application may how ever check to see if the user has modified the Background Refresh setting for itself.
Detecting user settings for Background App Refresh in iOS 7

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