private void SetCustomAction(PlaybackState.Builder stateBuilder) { MediaMetadata currentMusic = GetCurrentPlayingMusic(); if (currentMusic != null) { // Set appropriate "Favorite" icon on Custom action: var musicId = currentMusic.GetString(MediaMetadata.MetadataKeyMediaId); var favoriteIcon = Resource.Drawable.ic_star_off; if (_musicProvider.IsFavorite(musicId)) { favoriteIcon = Resource.Drawable.ic_star_on; } stateBuilder.AddCustomAction(CustomActionFavorite, "Favorite", favoriteIcon); } }
void SetCustomAction(PlaybackState.Builder stateBuilder) { MediaMetadata currentMusic = GetCurrentPlayingMusic(); if (currentMusic != null) { // Set appropriate "Favorite" icon on Custom action: var musicId = currentMusic.GetString(MediaMetadata.MetadataKeyMediaId); var favoriteIcon = Resource.Drawable.ic_star_off; if (musicProvider.IsFavorite(musicId)) { favoriteIcon = Resource.Drawable.ic_star_on; } LogHelper.Debug(Tag, "updatePlaybackState, setting Favorite custom action of music ", musicId, " current favorite=", musicProvider.IsFavorite(musicId)); stateBuilder.AddCustomAction(CustomActionThumbsUp, GetString(Resource.String.favorite), favoriteIcon); } }