Exemple #1
0
	    /**
	     * Set badge count on app icon
	     *
	     * @param context context activity
	     * @param count   should be >= 0, passing count as 0 the badge will be removed.
	     * @throws BadgesNotSupportedException when the current launcher is not supported by Badges
	     */
		public static void SetBadge(Context context, int count) {
			
	        if (context == null) {
	            throw new BadgesNotSupportedException();
	        }

	        var badgeFactory = new BadgeProviderFactory(context);
			var badgeProvider = badgeFactory.GetBadgeProvider();

	        try {
	            badgeProvider.SetBadge(count);
	        } catch (UnsupportedOperationException e) {
	            throw new BadgesNotSupportedException();
	        }
	    }