Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change notification sound dynamically in Android O

Recently I use notification channel to support android O. But the problem is I cannot change the sound Uri dynamically. Our app have notification sound setting which user can change app notification sound as they want. But as you know, Android now do not allow developer to update notification channel before user reinstall app. There I consider several possible solutions which is not looks good.

  1. User ringtone manager to play ringtone instead of setSound. But when user disable notification in app setting, still ringtone will not stop playing. (This will be bad user experience)

  2. Delete notification channel and create new one when user change ringtone sound. But this also looks bad because in app setting google shows the history of deleted channel info.(Actually not necessary)

Is there any good solution?

like image 629
Wooram Jung Avatar asked Apr 02 '18 05:04

Wooram Jung


People also ask

How do I change the auto notification sound on my Android?

You'll need to use the Android Auto companion app on your phone to find the setting. So open the Android Auto companion app, then head into settings. From there, you should see a new toggle for “No sound from notifications”. Just flip that and you'll be all set.

Can you change notification sound for different Apps?

On your device, navigate to Settings > Apps > Your apps. The menu names may be slightly different on some devices—for this guide, we'll be using a Samsung device. Find the app you wish to set a custom tone for and select it. On the app info page, tap Notifications and toggle on the slider button for Show notifications.


1 Answers

On Android O+ devices, you should remove any notification specific settings within your app and offer a link within your settings screen to open the system's notification channel settings, where the user can adjust the sound of the notification channel directly.

like image 63
ianhanniballake Avatar answered Oct 13 '22 09:10

ianhanniballake