Make sure the volume is turned up, otherwise you will not hear anything.
In general, it is not recommended to increase the volume level programmatically without any user input - unless the volume is usually reduced by user action.
But here is how you can do it:
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); am.setStreamVolume(AudioManager.STREAM_MUSIC, am.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
This will be the maximum STREAM_MUSIC . There are many other ways to control / change the volume.
Read this to familiarize yourself with volume control: http://developer.android.com/training/managing-audio/volume-playback.html
source share