My application has to play a sound. I use this code, and it works fine:
Using java Syntax Highlighting
- mp = new MediaPlayer();
- mp = MediaPlayer.create(theContext, R.raw.mynotif);
- mp.start();
- mp.setOnCompletionListener(new OnCompletionListener() {
- @Override
- public void onCompletion(MediaPlayer mp) {
- mp.release();
- }
- });
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
To test outside the emulator, I installed the APK on my phone.
Everything is ok, except one point:
when my phone is set to SILENT mode, the sound my application plays is NOT muted
Do I have to link my application sound volume to the global phone settings or something like this ?
Thank you for your help.
BlueF