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