Background modes are turned off automatically - objective-c

I have set in the Info.plist, the "app require background modes", the "app registers for location updates".
I put the app to be in the background, and I do get the location delegates for a while, but after 25 minutes it stopped getting the locations.
How do I know that? Each call of the delegate, it sends the data to the server (parse) .
I am also wondering if the problem arises because the location is turned off in the background, or because I can't send data to the server at background.
Also do I have to turn on audio to keep it alive?
According to Apple, I can listen in the background with:
apps that play audible content to the user while in the background, such as a music player app
apps that record audio content while in the background
apps that keep users informed of their location at all times, such as a navigation app
apps that support Voice over Internet Protocol (VoIP)
apps that need to download and process new content regularly
apps that receive regular updates from external accessories
Do I have to turn on an audio? Our app needs to get data location constantly from business.
This issue is amazing. There are dozens of opinions about what you can do and what you can't do. There is no one place that tells you how you can sample background locations, and if Apple allows this.

I guess problem is with pausesLocationUpdatesAutomaticallyBy
By default LocationManager pausesLocationUpdatesAutomatically is Yes, so after some if your device is not move or not change location may OS will stop the app, so set NO for this property , and not need to turn on an audio.

Related

geofencing no longer relaunch app from terminated state in ios7?

I'm developing an app which uses ibeacon to determine if the user entered a specific region.
Now I'm using the CoreLocation framework to implement this geofencing-based feature.
I've read the document below.
https://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
in which the Apple is saying that:
"In iOS, the regions you register with the location manager persist between launches of your application. If a region crossing occurs while your iOS app is not running, the system automatically wakes it up (or relaunches it) in the background so that it can process the event. When relaunched, all of the regions you configured previously are made available in the monitoredRegions property of any location manager objects you create. "
I discovered that it's true just before the ios 7.
From ios 7, An app will be waken-up from background but it will actually no longer could be re-launched from terminated-state (slided out from the task manager which displayed by double-clicking the home button).
If it's due to the Apple's policies, why does Apple not update the above official document?
So I'm thinking of an ios7's bug because the Reminder App (a built-in app) is also not relaunched in ios7 even though it's relaunched in ios6.
Is this issue due to Apple's policies? or an ios7's bugs?
It takes me more than 2 days to google for a solution.
Any ideas for this issue?
The documentation is simply out of date. This is intended behavior in iOS7. Apple produced a video explicitly discussing this change. The idea is that if the user explicitly terminates the app, the user does not want it running. See this thread.
Is this such a big deal? How often will users really do this? Remember, if users are annoyed by you app, they can always uninstall it, too. This was true in iOS6.
iOS 7.1 reversed this policy. That is even if the user kills your app the iOS still launches your app upon crossing the region.

Save Button Pushes and Location

I am making an app where I need to know
every button that was ever pushed by the user in the app, and when it was pushed, and
where the iPhone has gone (using gps), but there are no cell towers in the area so I can't use that significant location changes method everyone uses.
It seems to me like the Plist method for data saving won't work because I don't want the app to start where it left off, I want it to start at the beginning every time.
Also, if any of you have any idea how I can make my app wake up at certain specific times, and/or how I can make it impossible to exit, that would be awesome. This is for an experiment with the University of Queensland St. Lucio Psych Department and the Grute Eylandt Aborigines.
You can know everything the user does in your app if you want. You could use your own solution with an SQLite database for example, and dispatch the data to a server every once in a while.
The GPS is also easy, you could just track the user with the Core Location framework.
You can't make the app wake at specific times, the best you can do is implement push notifications but it's up to the user to open the app via the notification or by themselves by tapping the app icon on the iPhone home screen.
Otherwise you could set up a local notification just before exiting the application, this is faster and easier to implement then setting up push notifications.
There is also no way to stop the app being closed, that is until iOS 6 comes along with it's accessibility features, you can disable the home button then. But not now.

Value for External Accessory of "Required background modes" key in iOS5

I read iOS Programming Guide, and I found not only "audio, location, voip", but also "External Accessory & Newsstand apps" are allowed in background mode. documents are as following:
In iOS, only specific app types are allowed to run in the background:
Apps that play audible content to the user while in the background,
such as a music player app
Apps that keep users informed of their location at all times, such as a navigation app
Apps that supportVoice over Internet Protocol (VoIP)
Newsstand apps that need to download and process new content
Apps that receive regular updates from external accessories
However, I couldn't find the value for External Accessory in "Required background modes" key. Only I can choose is "App plays audio, App registers for location updates, App provides Voice over IP services".
Is it impossible to receive data from External Accessory when app is background mode ?
Thanks.
Though I couldn't select from lists, I could type "external-accessory", and it worked well.
Values for the UIBackgroundModes array for iOS5 and iOS6
audio
location
voip
newsstand-content
external-accessory
bluetooth-central
bluetooth-peripheral (supported from iOS6)

background app listen to audio input

Our app knows how to listen to the audio input. Can I open the app in the background (multi-tasking) and still get it to work as if it is open? Or can my app stay in the background and still get audio inputs,and output audio sounds? How i do that?
Set your AudioSessionCategory as AVAudioSessionCategoryRecord. The docs explain here that this category will allow you to record audio input even when the app is in the background. This will allow you to listen to the device input in an AudioQueue recording callback function. However, when this is occurring in the background, the status bar is tinted red by the system to alert the user that a backgrounded app is listening (and possibly recording) device input.
The phone is only allowed to do a few things in the background, like play sounds, and monitor location.
My guess is that this won't work, or if it does, it will be rejected by apple.
You may be able to get it working by playing a sound in the background and using that to keep the app alive to listen to the input. I'm not sure if this will work.

Is it possible to capture touch events in the background on a jailbroken iOS device?

I have an installation project in mind which involves a hacked iPad - I'd like to have a background process running recording all the touch events regardless of what app is running in the foreground, and send them out via OSC.
Note that this is using a jailbroken iPad with root access, and users will be alerted about not entering any sensitive data. But I'm not an iOS developer so I'm not sure if this is even possible. I'd appreciate any kind of input/suggestions.
[edit] Since someone questioned my motive behind this question, I'll try to explain a bit: to be specific, I'd like to build a mechanical system with Arduino that emulates the user's touch input on the iPad, but I do not want to limit them to using an app that does nothing else but recording touch events.
There are three options:
Use the IOHIDFamily subsystem to capture all the touch events. This will do most of the processing for you, the only thing you'll need to do is fetch the events using a HID client, get their types, and if they are touch events, get their position, radius and other things you need.
Use the MultitouchSupport framework. This way you will have to process the digitizer data frames manually which is tricky.
Use a MobileSubstrate hook to hook the already existing HID client inside SpringBoard.