Hide red bar while recording in background - ios

My app keeps listening to voices and analysis them to detect real panic screams. So I want to keep the app running 24/7, but when my app goes in background, the red bar appears on top. Since the recording has to be running for longer period, my app users won't afford to use it anymore. Do you think there is anyway to hide it while recording in background, does Apple has such policy to allow us in such case?
The same question was asked but none is given an answer yet.
I am using AVAudioSession with category AVAudioSessionCategoryPlayAndRecord with options AVAudioSessionCategoryOptionMixWithOthers

Do you think there is anyway to hide it while recording in background
Not "while recording in background". The user needs to know that this is happening.
You can eliminate the red bar — by changing your category and not recording in the background.
But you cannot record in the background without showing the red bar while you are in the background.

Related

Prevent Screen Light TURN OFF | Disable Sleep Mode in Watch Interface

In Apple Watch Interface, After some time screen light Turned Off. I want to prevent screen light Turn off. I have implemented timer like functionality, That will display objects and continuous change it (Like Photo Slider Album). It's long-running task 160-240 seconds.
Everything working fine BUT screen light turn off After some time. Is there any way to continues to Activate Watch Screen light?
Simply, I want to Turn ON watch screen light 160-250 seconds anyhow...
The timeout is a system limitation to conserve battery life, so it is not possible for a developer to prevent the Apple Watch display from entering a sleep state.

AVAudioSession red status bar with route change

When my app is sent into the background, a red status bar flashes briefly. I can live with that. The problem is, if the user then changes the route (eg., plugs or unplugs headphones), the red status bar comes on and stays on (until the app is killed or foregrounded).
My app uses audio session category AVAudioSessionCategoryPlayAndRecord, but not when backgrounded. I change the category to playback and then deactivate the audio session when the app goes into the background, but have not been able to suppress the red flash nor the bigger problem with route changes.
Looks like changing the category isn't sufficient -- if the session was created with inputEnabled true, then you're stuck with the status warnings. You'll have to release the session completely. See this question for discussion with final answer "...the only way is to actually release audioController."

Sleep Cycle - What kind of Backgroundmode is this?

I'm currently working on an app which reminds the user, when he gets to an certain location. I want this app working in background as well and searched for solutions.
In the AppStore i found the App called Sleep Cycle, which tracks your activities during your sleep. When you set the alarm, and running the App in the Background you get this screen red bar on the top of the Display of your iPhone.
http://i.stack.imgur.com/uEejp.jpg
Does anybody know what kind of Backgroundmode this is, and how i can transfer it to my app?
Thanks
To have such a red bar I use audio background mode and also I record sound in background. Since Sleep Cycle asks user to allow access to microphone I believe it also records audio in background

Why does my app make the recording (pulsing red) status bar appear when it isn't recording?

My app sometimes uses the microphone, but even when I am not using the microphone, the red status bar appears momentarily when leaving my app.
I have set AVAudioSession's category to SoloAmbient. When I record, I set it to PlayAndRecord, and when I am done I set it back to SoloAmbient. But even when the category is SoloAmbient I still see the red status bar.
Even when my app has not accessed the microphone at all I am still getting this red status bar behavior. I do not have the app configured for background audio. Any ideas what might be making the system think that I am recording?
EDIT: After some experimentation, it looks like I can prevent the app from causing the red status bar on launch by delaying creating of the recording AUGraph until I actually start recording.
However, I still see the red status bar after stopping recording. When I stop recording, I stop the AUGraph and dispose of it and change the AVAudioSession category back to SoloAmbient. But I still see the red status bar when I switch away from the app.
After a long long long long long research and hurdles I found out simple solution for this follow as below
In Targets->General->Deployment Info check the HideStatusBar Option
like below!
And in the ViewController (Which one you kept as RootViewController) in viewDidAppear add this line of code...
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Because when you uncheck HideStatusBar Option and your app needs any background process or audio related process then the status bar will become red with enlarged height. If you dont want status bar in entire app then dont add the above line in viewDidAppear and check HideStatusBar Option.

iOS - show consistent alert at the top of the UI when backgrounding the app (like personal hotspot does)

I am creating an alarm clock app that requires some user action within the app in order to turn the alarm off. Below is a picture of what another app, Sleep Cycle, does when you turn an alarm on and press the home screen (i.e. background the app).
Here is an image link (I can't post an image yet, no rep despite my many attempts to answer people's questions today) for the effect I want to re-create.
Those that have used iPhone's Personal Hotspot and connected a device will notice that it is the same effect, where a notification appears at the top of the UI - pushing everything down by around 20-40 points. This is highly desirable to an alarm clock app as it encourages the user to keep the app in the foreground so that the app can easily be entered when waking up (instead of relying on the 30 second sound window allowed by local notifications)
Does anyone have any ideas on how to implement this functionality. I assume that it must go somewhere in the:
- (void)applicationDidEnterBackground:(UIApplication *)application
tag within the AppDelegate, but I'm not sure what exactly I need to be reading up on. So if anyone has a link to some relevant Developer Docs that would also be extremely helpful.
Many thanks for your help,
Ryan
There are a handful of built in 'background modes' that change the status bar's appearance depending on what functionality an app provides whilst it's in the background. The one you've identified (a red status bar) is triggered when an app records audio whilst in the background. I presume Sleep Cycle must be acting as though it records audio just for this purpose. Other background modes include VoIP (which I think uses a blue status bar). Check out Apple's documentation on supporting these various background modes
In your case, you'd want to add audio to the UIBackgroundModes property in your Info.plist file.
But note that it wouldn't be unreasonable for Apple to reject an app during review if it pretends to perform one of these background tasks but doesn't. For example, there have been apps in the past that tried playing a silent audio clip continuously in order to stay awake in the background - needless to say Apple got wise to this and the app in question had to change its behaviour.

Resources