Default "beep beep" alarm ringtone

1.7k views Asked by At

Is there some default, safe to use, "beep beep"-styled ringtone on Andrid phones?

I have the following code

final Ringtone alarm = RingtoneManager.getRingtone(getActivity(), RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM));
alarm.setStreamType(AudioManager.STREAM_ALARM);
alarm.play();

It plays the alarm ringtone which wakes me up at morning, which is some soothing music. But I need something more alarming.

Sure, I can pack some sound file to apk, but I'd prefer to use some sounds already available on devices.

1

There are 1 answers

1
Mohammad Ersan On BEST ANSWER

Check my answer here:

How do I access Android's default beep sound?

try {
    Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
    r.play();
} catch (Exception e) {
    e.printStackTrace();
}

here is a way to list all notifications sound you have in your device

public Map<String, String> getNotifications() {
    RingtoneManager manager = new RingtoneManager(this);
    manager.setType(RingtoneManager.TYPE_NOTIFICATION);
    Cursor cursor = manager.getCursor();

    Map<String, Uri> list = new HashMap<>();
    while (cursor.moveToNext()) {
        String notificationTitle = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        Uri notificationUri = manager.getRingtoneUri(cursor.getPosition());

        list.put(notificationTitle, notificationUri);
    }

    return list;
}

after finding 'Helium' ringtone, use its Uri to play it:

 Uri heliumUri = findHeliumUri();
 Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
 r.play();