title: How to block iOS 7 control centre from controlling music app?
body: <p>Our app explicitly blocks user form using remote-control, e.g., old springboard from pre-iOS7, earbud, by becoming the first responder to the remote-control events. However, on iOS7, the same code fails to bypass the control centre music controls.</p>
  <p>From out tests, control centre seems to have bypassed ALL music control events including UIEventSubtypeRemoteControlPause and UIEventSubtypeRemoteControlPlay, and UIEventSubtypeRemoteControlTogglePlayPause.</p>
  <p>Is it that control centre has its own protocol for remote control or that the way to intercept remote-control events has changed in iOS7?</p>
  <p>The same blocking code still works perfectly with iOS6 devices. Here is what we do:</p>
  <ol>
  <li><p>Added a method in our appDelegate:</p>
  <p>(BOOL)canBecomeFirstResponder {
  return YES;
  }</p>
  </li>
  <li><p>Call this in applicationDidBecomeActive:</p>
  <p>[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];</p>
  <p>// Set itself as the first responder
  [self becomeFirstResponder];</p>
  </li>
  <li><p>Call this in applicationWillResignActive</p>
  <p>// Turn off remote control event delivery
  [[UIApplication sharedApplication] endReceivingRemoteControlEvents];</p>
  <p>// Resign as first responder
  [self resignFirstResponder];</p>
  </li>
  <li><p>Finally added</p>
  </li>
  </ol>
  <p>(void)remoteControlReceivedWithEvent:(UIEvent *)receivedEvent {</p>
  <pre><code>    if (receivedEvent.type == UIEventTypeRemoteControl) {
          
          switch (receivedEvent.subtype) {
                  
              case UIEventSubtypeRemoteControlTogglePlayPause:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlTogglePlayPause\n&quot;);
                  break;
                  
              case UIEventSubtypeRemoteControlPreviousTrack:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlPreviousTrack\n&quot;);
                  break;
                  
              case UIEventSubtypeRemoteControlNextTrack:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlNextTrack\n&quot;);
                  break;
                  
              case UIEventSubtypeRemoteControlPlay:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlPlay\n&quot;);
                  break;
  
              case UIEventSubtypeRemoteControlPause:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlPause\n&quot;);
                  break;
  
              case UIEventSubtypeRemoteControlStop:
                  NSLog(@&quot;Received: UIEventSubtypeRemoteControlStop\n&quot;);
                  break;
                  
              default:
                  NSLog(@&quot;Received: Some remove control events\n&quot;);
                  break;
          }
      }
  }
  </code></pre>
  <p>Any pointer will be appreciated.</p>