I'm developing an app that periodically sends a notification that makes the phone vibrate in a repeated pattern, however, it only works when the app is open and and the phone is unlocked. Whenever I receive the notification when the app is closed or the phone is locked it only plays the regular notification vibration that lasts a second or two.
This is the code I'm using to make the phone virbate.
vibratorManager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
val vibrator = vibratorManager?.defaultVibrator
vibrator?.vibrate(VibrationEffect.createWaveform(longArrayOf(0L, 300L, 500L, 300L), 1))
Is there any way to make it so the phone always vibrates, including when it is locked or with the app closed?