Disable iOS 5 Notification Center Gesture in App - objective-c

I'm developing a Kiosk-Mode Application and I want to prevent the notification center gesture (swipe down from top). Since the Application isn't distributed using the AppStore private APIs are allowed.
I have skimmed through the UIKit class dump but did not find any hints on how to disable it (resp. don't know where to look, tried UIApplication and UIWindow).
Has anyone tried this yet and had success?

It may be a little tricky, cause you are trying to disable native iOS function like all-fingers swipe gesture on iPad and so on. Some people use this method to define different notification center swipe side:
statusBarHidden = YES
and then you can redefine side:
setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft
as example.
I think you couldn't find any hacks to prevent iOS notification from showing at all. As last approach you can get some profit from dealing with jaiblroken features on unlocked devices...

Related

Xcode 7 - Multiple Storyboards

After finishing an app, what code do I have to put in appdelegate.m to be able to make it run view controllers depending on the device's size?
You should not use multiple storyboards to handle different devices in an iOS app. Please see the Apple documentation:
Adaptive User Interfaces
And in particular the section on Auto Layout to learn how to properly handle making your user interface adaptable to current and future devices.

iOS7: Control center, remote-control, and CoreAudio audio session solo-ambient category

Before iOS7 came, we noticed an issue:
Music remote-control from earbud or springboard can hijack our audio session even if we set the category to solo-ambient or another exclusive mode.
We thus tried a few things:
We tried to take ownership of the audio session back. But this requires that our audio code knows when to take it back and from whom. We thought we could let the app code become the first responder to remote-control events, do our stuff, and then pass the events on to the music app. However, we found that the events got detained by the first responder and there is no way to push it back to the chain of commands.
We tried to become first-resonder and block remote-control events all together when we are in solo-ambient. This worked fine with iOS6, still works with earbud control in iOS7, but fails with iOS7's control center. The control center seems to bypass the remote-control event handler remoteControlReceivedWithEvent completely, where we put our blocking code.
I read something elsewhere that:
You can't block the music app. your app can become one though (apple
won't like that) and then the control center would control yours.
But I found no documentation whatsoever about control center.
And as said above, control center does not enter the normal remote control hooks even if an app is the first responder.
Another quoteP
Remote Control Event handling is so your app can be controlled by
Control Center, the earbuds, etc... it is not so that your app can eat
said controls, preventing control of other apps from said sources. It
only worked in iOS6 because of a bug in iOS, now fixed in iOS7
Is it that what had were using was due this bug? I find it hard to believe because we got the solution on this list and the Xcode mailing list so I assume that was an accepted solution.
Now we really wonder if we are missing something from the very beginning:
Is solo-ambient really an exclusive mode for audio session or is it that music app is an exception to that exclusivity?
How can our app live in harmony with the remote-control, and control center?
Where can we find up-to-date documentation of remote-control and control center?
The remote control has been mysteriously fixed after clean building everything agains iOS7 SDK. Now app delegate can receive remote-control events from Control Center. However, the play/pause events are UIEventSubtypeRemoteControlPause and UIEventSubtypeRemoteControlPlay instead of the iOS6's UIEventSubtypeRemoteControlTogglePlayPause.

Disable the "Notification Center" on iPad (phonegap) application

Is there any way to remove the swipe event that pulls in the notification center from the top of the ipad when developing an ipad app? If there is an easy way in PhoneGap, that would be best, if not - I can manually implement any Objective-C solution.
The app is already in full screen, and there are some gestures that including swiping at the top. These iPads are distributed to the sales force of this company, and they want that feature (top swipe notification center) disabled.
Cheers!
When your app is in fullscreen mode, Notification Center switches to a two-swipe system: swipe once to bring up a little handle, and swipe down on the handle to bring up Notification Center. This should avoid most interference.
Other than that, there's no public way to disable this gesture.
Of course not. At least not without a jailbroken phone. Notification Center is built into the OS and cannot be disabled by third party apps. As #jtbandes pointed out, their is the "handle" option, but there is no way to completely disable the functionality.

How can you disable the iOS Notification Center within your App?

If you have a full screen iOS app and you want to prevent the notification center from being pulled down, can you and how?
Also can you block notification alerts or banners from displaying while your app is loading? (I think this is a no way for sure but wanted to ask just in case.)
It has been my experience that fullscreen apps (statusBarHidden = YES) have a slightly different notification center behavior by default: Swiping down over the area previously occupied by the status bar will only show a little tab. Only swiping the tab will then show the notification center. This has been enough to prevent accidental activation for me so far.
Currently, there is no public API for manipulating the behavior of the notification center. I am of the opinion that it's not likely that an app will ever be able to block a notification's appearance, and only slightly less unlikely that an app would be able to prevent the notification center from appearing. iOS is all about a consistent user experience experience at the price of developer freedom. I could see being frustrated by this kind of functionality if I were an unexpecting user.
All that said, there is always the dark-side of undocumented APIs. I would not be surprised if you could pull off some cleverness using those on a jailbroken device, but that's not my cup-o'-tea.
I just now figured this out. I am developing a game that runs in landscape and whenever I touched the left side, the notification center tab would appear. To fix this, you want to add the following:
setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft
I added this right after I setStatusBarHidden and I no longer have the problem of the notification tab.
Hope that helps.
An API was introduced in iOS 11, alongside a change in behavior to how Notification Center (and Control Center) is presented, to allow you to specify the desired behavior.
UIViewController.preferredScreenEdgesDeferringSystemGestures
In iOS 11+, Notification Center will always pull down when swiping from the very top of the screen, even if the status bar is hidden. preferredScreenEdgesDeferringSystemGestures allows you to specify that swiping a screen edge should not trigger the standard system UI, and instead it will provide a pull-out tab that the user must swipe again to bring out the system UI.
This is intended to be used for games where users swipe frequently, where it would be undesired to bring in system UI instead of control the game. For an immersive app like that, you can return .all to specify you don't want any system UI to appear the first time you swipe any edges of the screen, and it should instead prefer your app's own gestures.
Note that this will disable the ability to swipe once from the bottom to close an app on iPhones and iPads that don't have home buttons - the user will have to swipe twice to close the app.
There is still no way to completely disable Notification Center from within your app, nor prevent notifications from appearing while your app is in the foreground.
I built a very simple code snippet to address this issue programatically. I have a timer set-up in my app delegate that runs every .2 seconds each time it runs it keeps moving the status bar orientation so it doesn't impact the game play. I haven't experienced the annoying notification center in my app since! The only issue is the volume control rotates constantly and might be annoying but it's less annoying than notification center
int tick=0;
-(void)toggleNC
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
tick++;
if (tick==1)
{
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];
}
if (tick==2){
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
}
if (tick==3){
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
}
if (tick==4){
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
tick=0;
}
}

How Can I Get touch events in an iPad App's hidden status bar's area?

I read about this problem for the iPhone on the post here.
The post says it's only a simulator problem. Right now I've got the same problem on my iPad app, on the device itself. The app has a status bar - but after hiding it in app i can't click/touch in that area (using iOS version 4.2).
Thanks in advance.
If you're desperate enough, you could have your own window on top of the (invisible) status bar and process events in there. Set its windowLevel high enough and you're good to go. However, that might not be a good solution for you, because there's no way to forward touches from one window to another. You might end up having to do a lot of touch handling yourself.