【发布时间】:2015-02-19 07:20:15
【问题描述】:
我正在尝试从资产文件夹播放通知声音,但是当通知触发时,会显示通知但没有播放声音,并且 logCat 中没有错误或警告。我正在使用此代码创建通知:
builder = new NotificationCompat.Builder(context)
// Set Icon
.setSmallIcon(R.drawable.ic_launcher)
// Set Ticker Message
.setTicker(message)
// Set Title
.setContentTitle(message)
// Set Text
.setContentText(context.getString(R.string.app_name))
// Add an Action Button below Notification
.addAction(R.drawable.share,
context.getString(R.string.share), pendingShare)
// Set PendingIntent into Notification
.setContentIntent(contentIntent)
// Dismiss Notification
.setAutoCancel(true)
.setSound(
Uri.parse("file:///android_assets/"
+ prefs.getString(Constants.NOTIF_SOUND,
"mp3/al_affassi_full.mp3")));
有人可以帮我解决这个问题吗? 谢谢!
【问题讨论】:
标签: android android-notifications android-resources android-assets