首先是由于我没有对android O (26)+ 做处理。
android 26+ setSound 需要在 channel 上执行:
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build();
channel.setSound(soundUri, audioAttributes);
参看:https://stackoverflow.com/questions/48986856/android-notification-setsound-is-not-working
然而在调试过程中对channel 调用了setSound 还是不生效,最后发现,channel seSound 默认只在第一次安装时生效,只需要删除APP重新安装即可。