private async Task SetUpInAppNotificationsAsync()
        {
            await Task.Run(() => {
                if (!NotificationChannel.IsShellTileBound &&
                    Configuration.NotificationTypeContains(WPNotificationType.Tile))
                {
                    if (Configuration.AllowedTileImageUris != null && Configuration.AllowedTileImageUris.Any())
                    {
                        NotificationChannel.BindToShellTile(new Collection <Uri>(Configuration.AllowedTileImageUris));
                    }
                    else
                    {
                        NotificationChannel.BindToShellTile();
                    }
                }

                if (!NotificationChannel.IsShellToastBound &&
                    Configuration.NotificationTypeContains(WPNotificationType.Toast))
                {
                    NotificationChannel.BindToShellToast();
                }

                RegistrationId = NotificationChannel.ChannelUri.ToString();
                IsRegistered   = true;
                if (Registered != null)
                {
                    Registered(this, new DidRegisterForNotificationsEventArgs
                    {
                        RegistrationId = RegistrationId
                    });
                }
            }).ConfigureAwait(false);
        }
Exemplo n.º 2
0
 private void BindToTileNotifications()
 {
     try
     {
         if (NotificationChannel != null && !NotificationChannel.IsShellTileBound)
         {
             var listOfAllowedDomains = new Collection <Uri>(AllowedDomains);
             NotificationChannel.BindToShellTile(listOfAllowedDomains);
         }
     }
     catch (Exception ex)
     {
         OnError(ex);
     }
 }