Cas notification added.

This commit is contained in:
Tristan Roux
2018-12-12 18:03:59 +01:00
parent e449acc325
commit 6698c34946
2 changed files with 14 additions and 4 deletions
@@ -12,12 +12,23 @@ namespace MusicApp
{
public CastOptions GetCastOptions(Context appContext)
{
//NotificationOptions notification = new NotificationOptions.Builder()
// .
//Customise (or disable) build in notification here.
NotificationOptions notification = new NotificationOptions.Builder()
.SetActions(new List<string> { MediaIntentReceiver.ActionSkipPrev, MediaIntentReceiver.ActionTogglePlayback, MediaIntentReceiver.ActionSkipNext }, new int[] { 1 })
.SetTargetActivityClassName(Java.Lang.Class.FromType(typeof(MainActivity)).Name)
.SetSmallIconDrawableResId(Resource.Drawable.MusicIcon)
.SetSkipPrevDrawableResId(Resource.Drawable.SkipPrevious)
.SetPauseDrawableResId(Resource.Drawable.Pause)
.SetPlayDrawableResId(Resource.Drawable.Play)
.SetSkipNextDrawableResId(Resource.Drawable.SkipNext)
.Build();
CastMediaOptions media = new CastMediaOptions.Builder()
.SetNotificationOptions(notification)
.Build();
CastOptions options = new CastOptions.Builder()
.SetReceiverApplicationId(CastMediaControlIntent.DefaultMediaReceiverApplicationId)
.SetCastMediaOptions(media)
.SetStopReceiverApplicationWhenEndingSession(true)
.Build();
return options;
@@ -23,7 +23,6 @@ using Com.Google.Android.Exoplayer2.Source.Hls;
using Com.Google.Android.Exoplayer2.Trackselection;
using Com.Google.Android.Exoplayer2.Upstream;
using Com.Google.Android.Exoplayer2.Util;
using Java.Lang;
using MusicApp.Resources.values;
using SQLite;
using Square.Picasso;