I have used the following permission to solve this issue:
  
<uses-permission android:name="android.permission.WAKE_LOCK"/>    
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 

i invoked the am.setSpeakerphoneOn() in following manner
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
           am.setSpeakerphoneOn(true);
        }
 Hope it will help you.

On Tuesday, July 5, 2011 8:58:36 PM UTC+5:30, Sarbyn wrote:
>
> Hi! 
> I have a class that play a stream from internet, using an AudioTrack. 
> I want to route the audio to the speakerPhone, using: 
>
> AudioManager am = (AudioManager) 
> context.getSystemService(Context.AUDIO_SERVICE); 
> am.setSpeakerphoneOn(aActive); 
>
> But the permission "<user-permission 
> android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>" , in my 
> manifest, doesn't work. 
>
> LogCat says that 
> 07-05 16:20:11.749  1324  1328 W AudioService: Audio Settings 
> Permission Denial: setSpeakerphoneOn() from pid=5724, uid=10092 
>
> Any idea?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to