Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Sound rings only for a few seconds #454

Closed
g7i opened this issue Jul 11, 2022 · 9 comments · Fixed by #487
Closed

Android: Sound rings only for a few seconds #454

g7i opened this issue Jul 11, 2022 · 9 comments · Fixed by #487

Comments

@g7i
Copy link

g7i commented Jul 11, 2022

Sound rings only for a few seconds on Android 12 device. However on Android 11 it works just fine.

I tried to implement the notification on native side but faced the similar issue. Luckily I stumbled upon the following piece of code in this guide. After setting the flag it started working on Android 12 as well.

     // Set notification as insistent to cause your ringtone to loop.
     Notification notification = builder.build();
     notification.flags |= Notification.FLAG_INSISTENT;

Can we have an option to update the notification flags when calling displayNotification?

@helenaford helenaford changed the title Sound rings only for a few seconds on Android 12 Android: Sound rings only for a few seconds Jul 12, 2022
@helenaford
Copy link
Member

@g7i thanks for this information 🙏 trying to think what the best way is to introduce this, couple of options:
1 - have a new prop loopAudio: boolean
2 - a prop to add any flags like we do for a press action and launch activity

I think we could have both. But from the example you linked, it seems this is mainly useful for phone calls or any time ongoing is set to true

@helenaford helenaford added the needs-feedback Waiting on response to questions label Jul 12, 2022
@g7i
Copy link
Author

g7i commented Jul 13, 2022

@g7i thanks for this information 🙏 trying to think what the best way is to introduce this, couple of options: 1 - have a new prop loopAudio: boolean 2 - a prop to add any flags like we do for a press action and launch activity

I think we could have both. But from the example you linked, it seems this is mainly useful for phone calls or any time ongoing is set to true

We definitely need to have the 2nd option. There are a bunch of other flags as well. I'm not certain about the 1st one as it can be achieved through the flags itself but its fine if we have it.
Ongoing events also have a dedicated flag but it didn't fix the issue. Let me take a step back. The issue on Android 12 was Sound rings only for a few seconds and not a looping issue. The ringtone is >20s long. The flag somehow fixes it.

@helenaford
Copy link
Member

Oh, interesting, definitely can do both. But for the bubble flag, it cannot be set just by specifying the flag itself as stated in the docs. We have a draft p/r to add the ability to do this, we were waiting for the dependencies it needed to become more stable - at the time it was in beta. Definitely can revisit that soon.

Bubble p/r: #72

@sosunny
Copy link

sosunny commented Aug 6, 2022

@g7i thanks for this information 🙏 trying to think what the best way is to introduce this, couple of options: 1 - have a new prop loopAudio: boolean 2 - a prop to add any flags like we do for a press action and launch activity

I think we could have both. But from the example you linked, it seems this is mainly useful for phone calls or any time ongoing is set to true

Hi @helenaford would you kindly share if there are any updates or estimated timeline on this? We would also love to be able to set the Notification.FLAG_INSISTENT flag for insistent notifications on Android. Either of the options would be great. Thanks!!

@helenaford
Copy link
Member

It's what I'm working on now. ETA is early next week although I'm not sure about the other flag. I can open up the api so you can set it and try it out

@helenaford
Copy link
Member

this has been released in 5.6.0 🙏 https://notifee.app/react-native/docs/release-notes#560

@sosunny
Copy link

sosunny commented Aug 10, 2022

Works great!!! Thanks for the fast turnaround @helenaford 👍

@vikaskumar122232
Copy link

vikaskumar122232 commented Feb 28, 2024

I'm encountering the same issue when my app is in background mode. @helenaford

@mritul
Copy link

mritul commented Apr 20, 2024

Hi ! Would there be any way to loop it for iOS as well ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants