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.
Related
Firstly, I must explain this, I know this green bar appears if your app has support for CallKit and user went to background state from app, And these all works perfectly from my VOIP app.
But I want to implement something like Whatsapp iOS App which user can go to back instant message screen from a voice call and even client is in the active state, a green bar appears.
I do not know how WhatsApp has implemented this feature. But I guess it can be custom view (green bar when the app is in an active state but not in call screen).
Do you guys have any idea how can I implement this feature? Or Do the CallKit has any methods or something else to force to show green bar if the call screen is not appearing but also app is not in background state??
Can't you just put your colored bar at the top? I am not sure if your app is using navigation controllers, but if not you should be able to align a UIView between superview.top and safearea.top, and set it's backgroundColor to anything you want.
I would like to know if there is a way to make your app show a status bar when the app is performing a specific function. Sort of like Shazam does when Auto Shazam is on, but this might be because the microphone and not something in Shazam's app code but I am wondering if there is a way to programmatically achieve this. Preferably in Swift but Obj-C also works.
This isn't done directly by the app, this is done by the OS when the app is using one of a few features in the background
The bar is red when an app is using the microphone in the background.
The bar is blue when an app is accessing location in the background.
The bar is also blue when a device is connected to the Personal Hotspot.
The bar is green when the telephone (including WhatsApp) is being used.
There may be more colours for other scenarios, but these are the ones I've come across.
I don't know of a way to add this bar on demand.
What I want is that when my app just enter background, showing a notification view with custom text and keeping stay for few seconds. It can be look like banner notification or the red status bar with recording/calling. Is that possible? Any idea? Thanks.
here is the UI effect what I want
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.
Any one know how to show In-Call Status Bar with message from application when it is going to be in background? I know many applications from AppStore which can perform it. For instance: http://myevoz.com/. As I understood, they use SBStatusBar class to show it. I've tried to call setDoubleHeightStatusString method and got no result.
Any ideas or links to examples?
Thanks.
So, now I can see red double-height status bar without any SpringBoard tricks and using the only legal APIs. You just need to add background mode support for sound and perform recording simulation. That's all. You will see your application name on red statusbar, see the answer here:
SBStatusBarController instance