Detect Blue flashing status bar in ios programmatically - ios

When google map is using location service and we go to background then one status bar with blue flashing background with information "Google map is using your location" is coming.
Now when I open my application (or any other application) you always see that blue flashing bar .
My question is can I detect that status bar is with blue flashing information is active now or not programmatically?

UIApplicationDelegate has these 2 methods
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame; // in screen coordinates
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame;
You can refer this link for more details.
Detecting if user has in call / Any Activity status bar
Hopefully, it'll help you.Thanks.

Related

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.

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.

Enable iOS notification center, but keep the status bar hidden?

I want my application to not show the iOS status bar. I can do this in AppDelegate.m like so:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
application.statusBarHidden = YES;
return YES;
}
This hides the status bar great, but makes the iOS notification center and the iOS control center take 2 swipes to pull in. I do not want this behavior.
Any help would be fantastic. Thanks!
I'm sorry for the half-hearted answer, but I don't have enough rep to comment. Basically your app thinks it's in fullscreen mode, and that requires a 'double' swipe to bring up control center og notif-center. So you'll have to find a way to overwrite that default fullscreen behaviour

Do something when notification bar is selected

How do I do something when the ios notification bar(or whatever it is called) is dropped down? I want to show my loading picture when the user checks the bar when in my app. Netflix does this (at least in my ipad) when you are in Netflix and you drop the notification bar down, the Netflix app changes so that it is the same picture as when it is loading(their logo on a red background that takes up the whole view) and when the notification bar hides, it goes right back to whatever you were looking at. I'm more familiar with android so forgive my bad ios vocab.
I don't think you can sense when the notification center is pulled down from the status bar.
However, you can simply react to the
- (void)applicationWillResignActive:(UIApplication *)application
method (doc), in your AppDelegate. This method gets called the exact same moment you start pulling down the notification center, but it also gets called in other situations (for example, every time your app moves to background, or a SMS message comes in...).
If you need to differentiate the behavior from the - say - "background" case, you should note that when pulling down the notification center the - (void)applicationDidEnterBackground:(UIApplication *)application method doesn't get called, while in the background case, it does.
Hope this can help!

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.

Resources