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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -