Disable remote controls iOS - ios

By default, remote control is activated on my streaming application but under a certain circumstance I want to disable all controllers and show nothing when the screen is locked.
First I tried to set now playing info to nil like this [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo: nil]; and all text, image and progress disappear but the control buttons and volume bar was still showing.
After that I tried this [[UIApplication sharedApplication] endReceivingRemoteControlEvents]; but it gives me nothing, it shows the same thing on the screen as the previous method call.
For the record, I'm calling [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; on AppDelegate before I tried to call any of the previous methods.
So, I have not found anything related to this that could help me with my problem and I would appreciate any help :)

Related

Directly launch phoneNumber dialog on iPad

If I use the UIDataDetectorTypePhoneNumber on a UITextView, and click a phone number on a device that has no phone (e.g. iPad), I get a Send Message / Add to Contacts / Copy popover. Is there some way to bring up that dialog directly in code or would I have to reimplement?
I did try [[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:5555555"]]; but that does not bring up the dialog.
There are some subtle differences between how detected links and buttons behave and my client wants a clickable phone number that behaves like a button.
I did some method swizzling to see where this popover comes from, and it looks like it is generated before the openURL: method in UIApplication.
Digging further, it looks like the popover comes from some private objects in UITextView.
I think you'll have to reimplement.
Did you try it with some forward slashes?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5555555"]];
Possibly related to this.
Use telprompt://5555555 instead of tel:5555555

How to display playing indication icon on status bar?

My app plays audio streams, it works fine for all cases such as background etc. I am using AudioToolbox.framework and MediaPlayer.framework to play the audio, my query is when the app starts playing audio i would want the indicator on the status bar to be shown as it does for the default iPod player.
Can anyone guide me on how to display the play indication icon on the status bar as soon as my app starts playing audio and disappears when its paused/ stopped or terminated.
As is described by iHemantk:
You just have to register for remote control events and icon will show
up:
https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Remote-ControlEvents/Remote-ControlEvents.html#//apple_ref/doc/uid/TP40009541-CH7-SW3
they added this in 4.0... works well. whoever is first responder now
controls the icon... just won't work for anything pre-iOS4: put the
following in your -viewDidAppear method:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
and include this method in the code:
- (BOOL) canBecomeFirstResponder {
return YES;
}
this goes in `-dealloc`:
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
and while not necessary, you may want to include this in the
-viewWillDisappear:
[self resignFirstResponder];

AudioOutputUnitStart replace the Music app

My application (VoIP one) is using kAudioSessionCategory_PlayAndRecord category. Everything is working perfect expecting the fact that When calling AudioOutputUnitStart the Music App is replaced by my application.
Basically if I double tap the home button and flip to the music app, I can't see the default music app, instead I can see my application log near the music controls.
Anybody knows what can be?
Check if you call this somewhere
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
This may cause your app to appear in the music control bar

iPhone display screen lights not turning off automatically

I have observed that my I run my iPhone application (native) the display lights are not turning off as they usually do in other applications, I have waited for couple of minutes but it wont turn off until I exit my application.
Is there anything which I had messed up with that is not causing the automatic dimming?
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
Are the two lines to enable/disable the dimming of the screen in an iOS app. Double check and see if your app has any of these.
Put this code into application didFinishLaunchingWithOptions: method.
Have you used this in your app?
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
If so, remove it or set it to NO.

UIApplication removeStatusBarImageNamed doesn't work

i'm working on a jailbroken iphone with iOS 5.0.1, just want to access status bar image,
and my code is as follows:
-(void)addStatusBarImage
{
NSLog(#"addStatusBarImage");
[[UIApplication sharedApplication] addStatusBarImageNamed:#"sgtest" removeOnExit: YES];
}
-(void)removeStatusBarImage
{
NSLog(#"removeStatusBarImage");
[[UIApplication sharedApplication] removeStatusBarImageNamed:#"sgtest"];
}
my problem is, the add function works fine, but removeStatusBarImageNamed seems useless as the "sgtest" image still exists in the status bar unless my app is terminated.
status bar icon manager fix what thread have had set icon image. if another thread try to remove that icon, it fails. You need to do it in one thread.
Check out SpringBoardAccess project at github. You can use it as is or implement like.

Resources