Exemplo n.º 1
0
        /*
         * Invoked when showNotificationButton is clicked.
         * Creates a new notification and sets metadata passed as arguments.
         */
        public Notification CreateNotification(Priority priority, Category category, Uri contactUri)
        {
            var builder = new Notification.Builder(Activity)
                          .SetContentTitle("Notification with other metadata")
                          .SetSmallIcon(Resource.Drawable.ic_launcher_notification)
                          .SetPriority((int)priority.priority)
                          .SetCategory(category.ToString())
                          .SetContentText(string.Format("Category {0}, Priority {1}", category.ToString(), priority.ToString()));

            if (contactUri != null)
            {
                builder.AddPerson(contactUri.ToString());
                Bitmap photoBitmap = LoadBitmapFromContactUri(contactUri);
                if (photoBitmap != null)
                {
                    builder.SetLargeIcon(photoBitmap);
                }
            }
            return(builder.Build());
        }
		/*
		 * Invoked when showNotificationButton is clicked.
		 * Creates a new notification and sets metadata passed as arguments.
		 */
		public Notification CreateNotification(Priority priority, Category category, Uri contactUri)
		{
			var builder = new Notification.Builder (Activity)
				.SetContentTitle ("Notification with other metadata")
				.SetSmallIcon (Resource.Drawable.ic_launcher_notification)
				.SetPriority ((int)priority.priority)
				.SetCategory (category.ToString ())
				.SetContentText(string.Format("Category {0}, Priority {1}",category.ToString(),priority.ToString()));
			if (contactUri != null) {
				builder.AddPerson (contactUri.ToString ());
				Bitmap photoBitmap = LoadBitmapFromContactUri (contactUri);
				if (photoBitmap != null)
					builder.SetLargeIcon (photoBitmap);
			}
			return builder.Build ();
		}