mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 13:47:41 +00:00
TYPE_ALARM can return null. Adding a fallback.
This commit is contained in:
parent
01b1e6ee4a
commit
284ef5e571
@ -26,8 +26,11 @@ public class FindMyPhoneActivity extends Activity {
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
|
||||
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
|
||||
ringtone = RingtoneManager.getRingtone(getApplicationContext(), notification);
|
||||
Uri soundFile = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
|
||||
if (soundFile == null) {
|
||||
soundFile = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
|
||||
}
|
||||
ringtone = RingtoneManager.getRingtone(getApplicationContext(), soundFile);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 21) {
|
||||
AudioAttributes.Builder b = new AudioAttributes.Builder();
|
||||
|
Loading…
x
Reference in New Issue
Block a user