Android 8 notifications setSound not working

前端 未结 2 2035
[愿得一人]
[愿得一人] 2021-02-12 05:24

I have the following code but everytime I just hear the default android sound.

        // create  channel
        NotificationChannel channel = new Notification         


        
2条回答
  •  广开言路
    2021-02-12 06:10

    I tried to see the difference between your sound file and mine. I used Audacity software. Your sound file has sampling rate 22050Hz while the sound files i use are sampled at 44100Hz. So i converted your sound file sampling rate to 44100Hz and used that as notification sound. Now it works.

    The problem is with the sound file. May be it's new change in Android O because it's working fine on older Android version.

    This is how to resample-

提交回复
热议问题