Pugnotification icon indicating copy to clipboard operation
Pugnotification copied to clipboard

How to play a custom sound ?

Open afaucogney opened this issue 9 years ago • 4 comments

I put a mp3 in a res/raw directory

Then

         PugNotification.with(getApplicationContext())
                        .load()
                        .title(item.getBottle().getName())
                        .message("Encore un vin dégusté par " + item.getUser().getName())//" + "\n" + item.getBottle().getName()) +"de "+item.getBottle().getVintage() +" en "+ new WineColor(Integer.parseInt(item.getBottle().getColor())).getColorToString() +
                        .bigTextStyle(item.getUser().getName() + " à dégusté un " + new WineColor(Integer.parseInt(item.getBottle().getColor())).getColorToString() + " nommé " + item.getBottle().getName() + " et lui à donné la note de " + item.getTasting().getRate())
                        .smallIcon(R.drawable.icon_notif)
                        .largeIcon(b)
                        .color(R.color.interaction)
                        .flags(Notification.DEFAULT_SOUND)
                        .sound(Uri.parse("android.resource://" + App.getContext().getPackageName() + "/" + R.raw.tire_bouchon3))
                        .custom()
                        .setImageLoader(NotificationService.this)
                        .background(item.getBottle().getLabelPicturePath())
                        .setPlaceholder(R.drawable.pugnotification_ic_placeholder)
                        .build();

Did I miss something ?

afaucogney avatar Feb 17 '16 17:02 afaucogney

Hi @afaucogney ,

Apparently it's all right. I'll check as soon as possible! I have tested a simple notification?

halysongoncalves avatar Feb 28 '16 10:02 halysongoncalves

@afaucogney you should remove this line: .flags(Notification.DEFAULT_SOUND)

alistefano avatar Mar 13 '16 12:03 alistefano

@afaucogney It worked?

@alistefano Thank you for your help!

halysongoncalves avatar Mar 16 '16 12:03 halysongoncalves

hey ! It didnt worked for me still the default sound is playing and lights are also not working

SahajRana avatar Jul 31 '16 15:07 SahajRana