【发布时间】:2011-07-29 07:00:04
【问题描述】:
我想在模拟器中播放通知声音,但它不起作用; 我愿意:
notification.audioStreamType = AudioManager.STREAM_NOTIFICATION;
Uri u = Uri.parse("android.resources://my.package.name/" + R.raw.customsound);
notification.sound = u;
customsound 与 mediaplayer 一起播放得很好,但在通知中它除了跟随 LogCat 之外什么都没有:
07-29 12:44:36.326: INFO/StagefrightPlayer(34): setDataSource('/system/media/audio/ui/Effect_Tick.ogg') 07-29 12:44:36.396: WARN/AudioService(61): MediaPlayer IOException: java.io.IOException: Prepare failed.: status=0x1 07-29 12:44:36.396: DEBUG/MediaPlayer(61): 无法在客户端打开文件,正在尝试服务器端 07-29 12:44:36.446: WARN/NotificationService(61): java.io.IOException: Prepare failed.: status=0x1 07-29 12:44:36.446: WARN/NotificationService(61): 在 com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:90) 07-29 12:03:34.712: WARN/AudioService(61): MediaPlayer IOException: java.io.IOException: Prepare failed.: status=0x1
【问题讨论】:
标签: android audio notifications