Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem playing alarm sound

 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you write the code to stop the alarm..?? i have tried it but it doesn't stop ringing...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic