xamarin.android - Xamarin Android Background Notification Custom Sound -
is possible use custom sounds in xamarin android background notification? didnt find examples.
yep! here's example:
var pathtopushsound = $"android.resource://com.your.package/raw/{soundname}"; var sounduri = android.net.uri.parse(pathtopushsound); var builder = new notificationcompat.builder(_context) .setcontenttitle("title") .setcontenttext("text") .setpriority(1) .setsmallicon(resource.drawable.transparentlogo) .setongoing(true) .setsound(sounduri); builder.build();
the uri
path resource sound file lives, set uri
in notificationbuilder
using setsound
method.
Comments
Post a Comment