{"id":19039,"date":"2015-06-10T14:07:48","date_gmt":"2015-06-10T21:07:48","guid":{"rendered":"http:\/\/blog.xamarin.com\/?p=19039"},"modified":"2015-06-10T14:07:48","modified_gmt":"2015-06-10T21:07:48","slug":"keep-users-from-leaving-your-app-with-chrome-custom-tabs","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/keep-users-from-leaving-your-app-with-chrome-custom-tabs\/","title":{"rendered":"Keep Users from Leaving Your App with Chrome Custom Tabs"},"content":{"rendered":"<p>\t\t\t\t<a href=\"\/wp-content\/uploads\/sites\/44\/2019\/04\/ChromeCustomTabs.png\"><img decoding=\"async\" class=\"alignright wp-image-19042\" src=\"\/wp-content\/uploads\/sites\/44\/2019\/04\/ChromeCustomTabs.png\" alt=\"Xamarin Chrome Custom Tabs\" width=\"250\" height=\"414\" \/><\/a>Chrome Custom Tabs were one of the exciting announcements made at <a href=\"\/google-io-2015-recap-for-android-developers\/\" title=\"Google I\/O 2015\" target=\"_blank\">Google I\/O 2015<\/a>\u00a0that you can try now in your Xamarin apps.<\/p>\n<p>If your app is like many others today, you may provide your own in-app web browser experience when displaying linked web content to your users. This provides a seamless and branded user experience, but misses out on things like saved passwords and form data.<\/p>\n<p>With Chrome Custom Tabs, you get the best of both worlds. You can still deliver a branded experience that feels like it&#8217;s right inside your app, while your users get all of the power and familiarity of Chrome.<\/p>\n<h2>Loading a URL<\/h2>\n<p>Loading your URL in a Chrome Custom Tab couldn&#8217;t be any easier, as it only requires a couple of lines of code:<\/p>\n<pre class=\"lang:csharp decode:true\">\nvar hostedManager = new HostedActivityManager (this);\n\nvar uiBuilder = new HostedUIBuilder();\n\/\/ Add any optional customizations here...\n\nhostedManager.LoadUrl (\"http:\/\/xamarin.com\", uiBuilder);\n<\/pre>\n<h2>Customization<\/h2>\n<p>It&#8217;s easy to specify your own colors for branding the toolbar and start and exit animations for activity. This will ensure your users feel like they&#8217;ve never left your app.<\/p>\n<pre class=\"lang:csharp decode:true\">\n\/\/ Set the Toolbar Color\nuiBuilder.SetToolbarColor (Color.Red);\n\n\/\/ Customize animations\nuiBuilder.SetStartAnimations (this, Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);\nuiBuilder.SetExitAnimations (this, Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);\n<\/pre>\n<p>It&#8217;s also possible to add your own Toolbar items and menu items to the overflow menu.<\/p>\n<h2>Getting Started<\/h2>\n<p>While Chrome Custom Tabs currently only works with Chrome Dev (44 and higher), it will gracefully fall back to opening URL&#8217;s in your default browser if Custom Tabs aren&#8217;t available.<\/p>\n<p>Check out our <a title=\"Chrome Custom Tabs\" href=\"https:\/\/components.xamarin.com\/view\/chrome-custom-tabs?version=1.0.0.0\">Chrome Custom Tabs Component<\/a>, which includes a sample app to help you get started today!\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chrome Custom Tabs were one of the exciting announcements made at Google I\/O 2015\u00a0that you can try now in your Xamarin apps. If your app is like many others today, you may provide your own in-app web browser experience when displaying linked web content to your users. This provides a seamless and branded user experience, [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":39167,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[5,4],"class_list":["post-19039","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","tag-android","tag-xamarin-platform"],"acf":[],"blog_post_summary":"<p>Chrome Custom Tabs were one of the exciting announcements made at Google I\/O 2015\u00a0that you can try now in your Xamarin apps. If your app is like many others today, you may provide your own in-app web browser experience when displaying linked web content to your users. This provides a seamless and branded user experience, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/19039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/560"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=19039"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/19039\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/39167"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=19039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=19039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=19039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}