我在使用Xamarin.Android进行开发通知功能时,发现NotificationCompat.Builder(this)
只能接收1个参数,无法接收channel_id
参数。
无法像编译通过如下的代码
// Build the notification:
var builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.SetAutoCancel(true) // Dismiss the notification from the notification area when the user clicks on it
.SetContentIntent(resultPendingIntent) // Start up this activity when the user clicks the intent.
.SetContentTitle("Button Clicked") // Set the title
.SetNumber(count) // Display the count in the Content Info
.SetSmallIcon(Resource.Drawable.ic_stat_button_click) // This is the icon to display
.SetContentText($"The button has been clicked {count} times."); // the message to display.
经过验证发现,未引用Xamarin.Android.Support.v4
包,使用NuGet下载及安装完成即可。