sandalone sandalone - 10 months ago 55
Android Question

How to play default TICK sound?

I want to connect Android OS default tick sound (for example, the sound you hear when you long click Home button and select previous app to start) with my button click. I know how to play sounds via MediaPlayer, but I do not know where to search for this default tick sound. It had to be in some default resources, but I could not find it.

MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound);

Anyone can help?

PS. this sound will be activated inside of onClick method.

PPS. I know I can user /raw dir, but I do not think there's a need for it. Not to say, it's cooler to play this tick sound prepared for user's phone.


I think the sound that you are looking for is and is in - /system/media/audio/ui/KeypressStandard.ogg

I think you can give that path to the SetDataSource API of the mediaplayer. But I am not really sure if it will have the same name in all android phones.

There might be a better way to query for default click sound..

NOTE - This is a pretty old and wrong answer. Please check @Roberto Tyley answer below.