1

I am able to play Remote Push Notification sound. But sound stops as soon as the sound file placed in raw folder plays completely. I want to play sound in repeat mode till there is a user action.

Can't use FLAG_INSISTENT with notification builder as it is a remote notification.

user1517153
  • 336
  • 2
  • 10
  • Playing sound in repeat mode for a notification is not good for UX .. I don't Notification builder support such feature .. you have to play sound with a `MediaPayer` probably in a service and that's too much i guess... – ADM Apr 14 '20 at 18:46
  • @ADM This alert is very important for the user like a 'THEFT ALERT'. I cannot play MediaPlayer as when application is killed, onMessageReceived() is not called on many devices and hence the alert is missed. – user1517153 Apr 15 '20 at 06:46
  • [notification messages](https://stackoverflow.com/questions/37358462/firebase-onmessagereceived-not-called-when-app-in-background) will be deliver to `#onMessageReceived()` .. There are two types of messages in FCM notification and data .. You should use `notification messages` . and start a service to play the sound . – ADM Apr 15 '20 at 07:21
  • We can start a service when we receive FCM inside app but **notification messages** are directly rendered in notification panel. #onMessageReceived() is not called in this case. – user1517153 Apr 15 '20 at 07:39

0 Answers0