title: Answer a call programmatically
body: <p>I've searched through a lot of topics, and I know my question was asked before. I'm writing an aplication that overrides default incoming call application. There is no good solution, yet the best one I've found is to use</p>
  
  <pre><code>    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");
  
      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>
  
  <p>But it's not working all the time. Another one using telephony service is not working for android versions 2.3+. I wonder how applications like <a href="https://play.google.com/store/apps/details?id=com.lowveld.ucs&amp;feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5sb3d2ZWxkLnVjcyJd" rel="nofollow">Ultimate Call Screen</a> answers a call. Any ideas?</p>