fix a crash caused by no permission accessing the default notification sound

This commit is contained in:
tibbi 2017-01-06 20:32:58 +01:00
parent 9ef8fd775b
commit 12892b0300
2 changed files with 12 additions and 6 deletions

View File

@ -53,6 +53,11 @@
android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.LicenseActivity"
android:label="@string/third_party_licences"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
<activity
android:name=".activities.DayActivity"
android:label="@string/details"
@ -63,11 +68,6 @@
android:label="@string/event"
android:parentActivityName=".activities.DayActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.LicenseActivity"
android:label="@string/third_party_licences"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
<activity
android:name=".activities.SettingsActivity"
android:label="@string/settings"

View File

@ -51,5 +51,11 @@ class Config(context: Context) : BaseConfig(context) {
prefs.edit().putInt(REMINDER_MINUTES, mins).apply()
}
fun getDefaultNotificationSound() = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
fun getDefaultNotificationSound(): String {
try {
return RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
} catch (e: Exception) {
return ""
}
}
}