I am currently working on an Android App, that needs to alarm the user in case of an emergency. When the app needs to alert, it notifies the user with a heads-up notification and plays a loud sound. My problem is that I can't get the sound to repeat itself after it ends. I basically want it to loop until the users opens the notification.
I've tried to use Notification.FLAG_INSISTENT in both notification.flags and audioAttributes.setFlags(...) (inside of notificationChannel.setSound(audio, audioAttributes)), however this doesn't work.
Thanks ^^
I check in DeskClock app in AOSP, they set sound of notification to null then use MediaPlayer to play sound.
https://cs.android.com/android/platform/superproject/main/+/main:packages/apps/DeskClock/src/com/android/deskclock/NotificationUtils.kt