title: Enable android's phone speaker in program
body: <p>I wrote an app that handles incoming calls and answers them automatically. I want to set voice to phone's loud speaker and it works fine on android up to 4 but not 4.1 and 4.2.</p>
  
  <p>Code:</p>
  
  <pre><code>AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
  audioManager.setMode(AudioManager.MODE_IN_CALL);
  audioManager.setSpeakerphoneOn(true);
  </code></pre>
  
  <p>I have required permission in my manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /&gt;
  </code></pre>
  
  <p>I am getting a silent exception in my LogCat that says that I have not <code>MODIFY_PHONE_STATE</code> permission but I have defined this in manifest:</p>
  
  <pre><code>java.lang.SecurityException: Neither user 10046 nor current process has android.permission.MODIFY_PHONE_STATE.
  at android.os.Parcel.readException(Parcel.java:1425)
  at android.os.Parcel.readException(Parcel.java:1379)
  at com.android.internal.telephony.ITelephony$Stub$Proxy.silenceRinger(ITelephony.java:577)
  at net.farayan.android.driveranswer.AutoAnswerIntentService.answerPhoneAidl(AutoAnswerIntentService.java:155)
  at net.farayan.android.driveranswer.AutoAnswerIntentService.onHandleIntent(AutoAnswerIntentService.java:92)
  at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.os.HandlerThread.run(HandlerThread.java:60)
  </code></pre>