If my app is in background/suspend mode, it will fetch data and work fine. But when I restart the iPhone the app isn't more in the background mode.
Is it possible on device start, that the app will be in the same mode (background mode) as before the restart without user activity?
Afaik, this is only possible if you specify voip as your background mode.
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22
Related
UILocalNotification is not coming when i have supervise my iPad in single app mode. Same code is working fine when device is in normal mode when app is in background/killed or any other state.
But after Supervise device in single app mode with same app Notifications is not coming.
In my case app will never gone in background but may be device in sleep mode.
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.
Can I check device brightness of iOS device's screen if application is in background state to see if the device is in use or not? If not, is there any other solution to check if device is in running state or in idle state?
No, if your app is backgrounded is suspended until an event wakes it up.
You can't monitor the behaviour of the phone from a backgrounded app.
You will not have control over the application when its in background state. you can monitor it only when your application is in active state.
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.
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.