i have the following xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Ringtone preference" android:key="ringtone_option_preference">
<RingtonePreference
android:key="ring_tone_pref"
android:title="Set Ringtone Preference"
android:showSilent="true"
android:ringtoneType="notification"
android:summary="Set Ringtone"/>
</PreferenceScreen>
And i want every time a notification is about to show, to look at the value of the ringtone and beep accordingly :)...To be more precise my notifications are generated in a broadcastReceiver class and each time the receiver catches something it creates a new notification...I just want the ringtone of the notification to change based on the ringtone set in the preferences..
How can I do that?
Thanks
Mike
Nevermind I found it:
SharedPreferences preference = PreferenceManager.getDefaultSharedPreferences(context);
String strRingtonePreference = preference.getString("ring_tone_pref", "DEFAULT_SOUND");
notification.sound = Uri.parse(strRingtonePreference);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With