NotificationCompat.Builder builder = new NotificationCompat.Builder(Activity) .SetautoCancel(true) .SetContentIntent(resultPendingIntent) .SetContentTitle("My Notifications") .SetContentText(" Work dammit -_-"); notificationmanager notificationmanager = (notificationmanager)Activity.GetSystemService(AndroID.Content.Context.NotificationService); notificationmanager.Notify(buttonClickNotification,builder.Build());解决方法 我找到了解决问题的方法.
I got my solution from here
voID CreateNotification(string Title,string desc) { //Create notification var notificationmanager = GetSystemService(Context.NotificationService) as notificationmanager; //Create an intent to show ui var uiIntent = new Intent(this,typeof(MainActivity)); //Create the notification var notification = new Notification(Resource.Drawable.Icon,Title); //var notification = new Notification(AndroID.Resource.Drawable.SymActionEmail,Title); //auto cancel will remove the notification once the user touches it notification.Flags = NotificationFlags.autoCancel; //Set the notification info //we use the pending intent,passing our ui intent over which will get called //when the notification is tapped. notification.SetLatestEventInfo(this,Title,desc,PendingIntent.GetActivity(this,uiIntent,0)); //Show the notification notificationmanager.Notify(1,notification); }总结
以上是内存溢出为你收集整理的c# – 状态栏通知xamarin native android全部内容,希望文章能够帮你解决c# – 状态栏通知xamarin native android所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)