Notification sounds are getting suppressed due to Xiaomi sound settings. If Allow sound is toggled off notification sound will not be played. I want to show a popup to the user if this setting is disabled, but I am not able to fetch this setting using Notification manager or Android Manager. How can I fetch this os specific setting so that I can nudge the user?
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.
I have created a notification channel and added sound attributes to it.
The issue I am facing is that I am not able to loop the notification sound until the notification has been cancelled. I am using the flag FLAG_INSISTENT, with the NotificationBuilder, which as per the documentation, does the following -
Bit set in the Notification flags field if the audio will be repeated until the notification is
cancelled or the notification window is opened.
This flag plays the sound in the loop but once notification window is opened(the notification panel is dragged down) the notification sound stops. Is there any alternative way to play the ringtone until the notification has been cancelled.
PS- I have explored other options such as MediaPlayer (which requires storage permission to play ringtone in external storage) and Ringtone object(this has the function of setLooping() which was added in API 28 and no alternative for lower SDKs)
Trying to stop "Kijiji" from making noise every time I get a reply but the app has no way to disable the notification sound.
Any way to disable the notification sounds via ADB? I know you can disable vibration for specific apps so I think you can disable notification sounds also.
I am trying to play Notification Sound without disturbing other Music playing
Notification Sound can be played by 2 ways
1) Played by OS itself via NotificationBuilder
Benifits:- Handle itself all the cases of not playing sound in Phone Calls and other cases as well
Problem:- When music is playing and notification comes, then it shifts audio focus from music to notification, there by lowering or silencing music depending on how that music player app has handled the loss in audio focus.
2) We play sound via our media Player whenever notification comes
A) Play on NOTIFICATION STREAM ---> works perfectly fine but gives probem of ducking when played via earphones
B) Play on SYSTEM STREAM
Benifits:- No shifting of audio focus, so no effect on music when notification comes
Problem:- We will have to handle other cases of not playing sound in Telephonic call and VOIP as well...and may be other not known cases as of now .
But I figured it that watsup is doing fine.
So don't know how it is doing it
Per the Android 5.0 behavior changes on notification sounds:
If you are currently adding sounds and vibrations to your notifications by using the Ringtone, MediaPlayer, or Vibrator classes, remove this code so that the system can present notifications correctly in priority mode. Instead, use Notification.Builder methods to add sounds and vibration.
Setting the device to RINGER_MODE_SILENT causes the device to enter the new priority mode. The device leaves priority mode if you set it to RINGER_MODE_NORMAL or RINGER_MODE_VIBRATE.
Previously, Android used STREAM_MUSIC as the master stream to control volume on tablet devices. In Android 5.0, the master volume stream for both phone and tablet devices is now unified, and is controlled by STREAM_RING or STREAM_NOTIFICATION.
As there is not a direct way to detect whether a device is in priority mode, you should always use the Notification.Builder/NotificationCompat.Builder methods to add sound to your notifications to ensure you meet the user's expectations.