public void AddWebSiteShortcut(string urlAsString) { var uriFinal = urlAsString; CallShortcutManager(() => { var shortcut = CreateShortcutForUrl(NormalizeUrl(uriFinal)); return(mShortcutManager.AddDynamicShortcuts(new List <ShortcutInfo> { shortcut })); }); }
public async Task AddShortcut(Shortcut shortcut) { if (!_isShortcutsSupported) { throw new NotSupportedOnDeviceException(NOT_SUPPORTED_ERROR_MESSAGE); } var context = Application.Context; var builder = new ShortcutInfo.Builder(context, shortcut.ShortcutId); var uri = AUri.Parse(shortcut.Uri); builder.SetIntent(new Intent(Intent.ActionView, uri)); builder.SetShortLabel(shortcut.Label); builder.SetLongLabel(shortcut.Description); var icon = await CreateIcon(shortcut.Icon); if (icon != null) { builder.SetIcon(icon); } var scut = builder.Build(); if (_manager.DynamicShortcuts == null || !_manager.DynamicShortcuts.Any()) { _manager.SetDynamicShortcuts(new List <ShortcutInfo> { scut }); } else { _manager.AddDynamicShortcuts(new List <ShortcutInfo> { scut }); } }