Android 8 notifications setSound not working

前端 未结 1 1326
忘掉有多难
忘掉有多难 2021-02-12 05:53

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

        // create  channel
        NotificationChannel channel = new Notification         


        
1条回答
  •  遥遥无期
    2021-02-12 06:23

    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-

    0 讨论(0)
提交回复
热议问题