Guest User

Untitled

a guest
Jan 16th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. //Create notification
  2. var notificationManager = GetSystemService(Context.NotificationService) as
  3. NotificationManager;
  4.  
  5. //Create an intent to show ui
  6. var uiIntent = new Intent(this, typeof(MainActivity));
  7.  
  8. //Create the notification
  9. var notification = new Notification(Resource.Drawable.Icon, "Tienes notificación");
  10. //var notification = new Notification(Android.Resource.Drawable.SymActionEmail,title);
  11.  
  12. //Auto cancel will remove the notification once the user touches it
  13. notification.Flags = NotificationFlags.AutoCancel;
  14.  
  15. //Set the notification info
  16. //we use the pending intent, passing our ui intent over which will get called
  17. //when the notification is tapped.
  18. notification.SetLatestEventInfo(this,"Tienes nueva notificación", "Te ha enviado una solicitud de contacto", PendingIntent.GetActivity(this, 0, uiIntent, 0));
  19.  
  20. //Show the notification
  21. notificationManager.Notify(1, notification);
Add Comment
Please, Sign In to add comment