Issue
I'm trying to play notifications sound from the assets folder, but when notification triggers the notification is shown but no sound is played and there is no error or warning in the logCat. I'm using this code for creating notifications:
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")));
can someone help me solve this issue? Thanks!
Solution
Put your mp3 file under raw
folder. If you put it under asset/
it's going to be compressed twice and you can't use it.
Answered By - greywolf82
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.