title: Accept incoming call in android 2.3.5
body: <p>I am writing an application which override the default incoming call screen. So I have a button in my application for receiving calls. When user click on the button then the application will accept the call. So far I successful done on this application and can be using in android 2.3.4 or below without any problem. However, when I use the same application in android 2.3.5 , it cant accept the call. So I was wondering if there is another solution to accept call programmatically in android 2.3.5. Thanks in advance for any guidance provide. Below are the code for accept call.</p>
  
  <pre><code>    private static void answerPhoneHeadsethook(Context context) {
      // Simulate a press of the headset button to pick up the call
      Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON);             
      buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
      context.sendOrderedBroadcast(buttonDown, "android.permission.CALL_PRIVILEGED");
  
      // froyo and beyond trigger on buttonUp instead of buttonDown
      Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);               
      buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
      context.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
  }
  </code></pre>