GeeCON Prague 2014*
The moose likes Android and the fly likes Problem playing alarm sound Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "Problem playing alarm sound" Watch "Problem playing alarm sound" New topic
Author

Problem playing alarm sound

Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
I'm trying to make a simple alarm clock. But i cant get the alarm to ring..

This is my method:



Does anyone know whats wrong? I keep googling but I only get a lot of message-alarm-problems. Or mp3-play/video-stream problems.
This is the error:

03-08 14:54:27.671: D/MediaPlayer(472): Couldn't open file on client side, trying server side
03-08 14:54:27.680: E/MediaPlayer(472): Unable to to create media player
03-08 14:54:27.680: E/RingtoneManager(472): Failed to open ringtone content://settings/system/alarm_alert


Thanks in advance,
Johannes
Przemek Boryka
Ranch Hand

Joined: Dec 06, 2011
Posts: 51

Hi!

I wrote two lines of code :



After running the programme I have heard sound, so I think you don't have default ringtones at "content://settings/system" or you made something wrong.

Try put those two lines in new empty android project and test it. You should hear sound.



Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
Przemek Boryka wrote:Hi!

I wrote two lines of code :



After running the programme I have heard sound, so I think you don't have default ringtones at "content://settings/system" or you made something wrong.

Try put those two lines in new empty android project and test it. You should hear sound.




Doesint work for me, it should be possible to play the alarm on the eclipse emulator right?
Przemek Boryka
Ranch Hand

Joined: Dec 06, 2011
Posts: 51

Hi !

I tested it on real device not emulator, try to deploy application on mobile device, I don't know, maybe emulator doesn't have default Ringtones, I am not sure. Try to export your programme to apk and by USB copy it on mobile device and install it.

:/ Good luck

Bye

Just now, I have tested the same code on emulator, it doesn't work for me. I think the emulator do not handling sound system. But I am not sure. :/
Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
Przemek Boryka wrote:Hi !

I tested it on real device not emulator, try to deploy application on mobile device, I don't know, maybe emulator doesn't have default Ringtones, I am not sure. Try to export your programme to apk and by USB copy it on mobile device and install it.

:/ Good luck

Bye

Just now, I have tested the same code on emulator, it doesn't work for me. I think the emulator do not handling sound system. But I am not sure. :/



I found the problem. The ringtone was set to silent since there was no ringtones in the emulator.
I had to push a mp3-file to the sd-card and set it as ringtone. Now everything works!
jay nirgudkar
Greenhorn

Joined: Oct 24, 2013
Posts: 1
can you write the code to stop the alarm..?? i have tried it but it doesn't stop ringing...
 
GeeCON Prague 2014
 
subject: Problem playing alarm sound