RingtoneManager.setActualDefaultRingtoneUri not working for some Samsu

My app allows users to customize ringtones for both calls and notifications. It achieves this by setting the default ringtone using the following code:


RingtoneManager.setActualDefaultRingtoneUri(myContext, RingtoneManager.TYPE_RINGTONE, uri);


RingtoneManager.setActualDefaultRingtoneUri(myContext, RingtoneManager.TYPE_NOTIFICATION, anotherUri);

While this approach works well on most devices, I’ve received reports from some users with Samsung phones specifically (specially S24 using Android 14). The app successfully changes the call ringtone, but not the default notification ringtone.

When it fails, it shows this exception:

java.lang.IllegalArgumentException: You cannot keep your settings in the secure settings.

I have tried using stock-built-in ringtones as well as external mp3 files. All seems to work for TYPE_RINGTONE but not for TYPE_NOTIFICATION.

Can anyone help with this?

Hello @antonioromero0174,

Welcome to the Samsung Developers Forum.

Please create a support ticket in our dedicated Developer Support Channel with more details so that we can take a better look at the issue.

Best Regards,
Samsung Developer Relations