0

Is it possible to play an MP3 file in Android as system sound?

My problem is that I am developing an application that should play different SMS tones when the application receives an SMS from a particular phonenumber. In the way it is working right now, I'm using a combination of MediPlayer, AssetFileDescriptor and AudioManager to play the MP3 file, and it's working OK except for one big bug: if user has lowered the media volume to 0, the received sms will be missed because the MP3 cannot be heard.

So, it is possible to get a MP3 file to play using the system sound player? Or get the mediaplayer to use the system sound volume settings?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Robert
  • 4,602
  • 4
  • 22
  • 33

1 Answers1

0

I think that your best shot it to work with the RingtoneManager

You need to add the sound you want to play first into the manager and then you can play it using an intend

Here is an explanation of how it can be done: https://stackoverflow.com/a/1287415/458365

Hope it helps.

Community
  • 1
  • 1
pablisco
  • 14,027
  • 4
  • 48
  • 70