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

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.

Related

Hide red bar while recording in background

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.

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

iOS 7 red status bar

When Shazam is opened the status bar turns red and doubles it's height because of background recording, but this ruins the UI in my app. I'm now trying to change my code to support different status bar sizes, because the red status bar is also opaque, but I can't come up with a general solution because of this:
When the status bar is initially red, when I launch my app, the launch image is scaled and ruined. How to fix this?
Note: My app does NOT use recording.
[Edit]
The only solution I found was to set 'Status bar is initially hidden' to YES in .plist. I don't really need the status bar to be visible on app launch, especially if it affects my launch image when the status bar is taller than usual, i.e. when recording or during a phone call.
[Edit 2]
There are cases when the launch image will be briefly visible when the app is brought to foreground from background state. To work around this I use view-controller based status bar appearance:
- (BOOL)prefersStatusBarHidden
{
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
{
return YES;
}
return NO;
}
This ensures the status bar is always hidden when the app comes to foreground, so the launch image will never be affected. Don't forget to call setNeedsStatusBarAppearanceUpdate on appDidEnterBackground and (inside an animation block) on appDidBecomeActive notifications.
The red status bar is a system function. You are not going to be able to work around this - and it isn't really your 'fault' if the launch screen looks like that - if the user wants to open your app while using Shazam, they are going to see the red bar and the launch image is going to be scaled. You could change the launch image to look good when scaled, but then it would look bad the rest of the time (when the red bar wasn't at the top of the screen on launch).
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.

Should the location service indicator (arrow in the status bar) be displayed when using startMonitoringSignificantLocationChanges?

Is it normal to have the 'GPS arrow' in the status bar mentioning that the location service is running when using startMonitoringSignificantLocationChanges ?
Indeed, I don't want this arrow to appear in the status bar when my app is in background (because the user will think that my app reduces its battery life). But I need to track the significant position changes !
Here is the behaviour I have up to now:
My app is in foreground (no arrow displayed in the status bar)
The user clicks on the home button => I execute startMonitoringSignificantLocationChanges when entering in applicationDidEnterBackground delegate method => the arrow appears... (what I don't want!)
Please, tell me if it is normal to have the arrow in the status bar when launching startMonitoringSignificantLocationChanges and if there is a way to remove it.
Thanks !
Yes, it is normal. Your app could be woken by the OS to respond to a significant location change, and that is what the status bar indicator shows. There's a related iOS bug (Richard Groves's answer) at Locationservice Indicator stays "on". I don't know any way to suppress the status bar indication.

how to get a handle on the status bar in iOS

I have an audio recording application. And when it is recording in the background, I see a red horizontal bar on the top with my project name on it. I want to get a handle on that bar so that I can display additional things there. How do I get a handle on it and what exactly is that bar called?
If your app is not running in the foreground you don't have access to the screen, so you can't get a handle to the status bar. And even if you could, you wouldn't be able to change it.

Resources