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

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

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -