【发布时间】:2013-09-11 06:00:45
【问题描述】:
历史:
我从网络服务器下载铃声,如果安装了 SD 卡,我将该文件保存到 SD 卡路径,例如 mnt/sdcard/.my_folder_name/abc.mp3 ELSE 使用 context.getFilesDir() 保存到内部存储器,例如 data/data/my .package.name/abc.mp3
问题:
我在通知栏中触发 Android 通知,通知工作正常,但是当我从内部存储器设置 NOTIFICATION SOUND URI 时出现问题,它不播放声音。
在外部存储的情况下,工作正常并播放声音
ringtoneUri = Uri.parse("file:///mnt/sdcard/.my_folder_name/abc.mp3");
notification.sound = ringtoneUri;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.audioStreamType = AudioManager.STREAM_NOTIFICATION;
notificationManager.notify(1, notification);
在内部存储的情况下,不播放声音我检查了文件,它存在那里
ringtoneUri = Uri.parse(context.getFilesDir().getPath()+"/abc.mp3");
//data/data/my.package.name/files/abc.mp3
notification.sound = ringtoneUri;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.audioStreamType = AudioManager.STREAM_NOTIFICATION;
notificationManager.notify(1, notification);
我做错了吗???
问候,
【问题讨论】:
-
没有答案?? :( 它的紧急...
标签: android notifications audio