#SushiHangover.GoogleChrome.CustomTabs.Shared
Xamarin.Android
implemetation of Android.Support.CustomTabs.Shared
with demos
####Current project status:
This is a Xamarin.Android
C#
port of Google's Java
-based CustomTabs
code:
Ref: GoogleChrome/custom-tabs-client
- Java-based Application -> C#-based Application
- Java-based customtabsdemos -> C#-based AndroidCustomTabs
- Java package
org.chromium.customtabsclient.shared
converted to C# and publiched as a Nuget in namepsaceAndroid.Support.CustomTabs.Shared
###Using Chrome-based CustomTabs is Easy:
var url = "https://www.xamarin.com";
var customTabsIntent = new CustomTabsIntent.Builder().Build();
CustomTabActivityHelper.OpenCustomTab(this, customTabsIntent, Uri.Parse(url), new WebviewFallback());
If Chrome is not installed, you have complete control over a fallback, the above example is using a WebView-based Activity as the fallback
- Logcat output (Chrome Beta installed and being used):
[CustomTabsHelper] PackageNameToUse: com.chrome.beta
- Logcat output (Chrome is not install, using WebView:
[CustomTabsHelper] PackageNameToUse:
[WebViewFactory] Loading com.android.webview version ....
When using the KeepAliveService
via AddKeepAliveExtra(...), you can monitor your application's
Importanceand its elevation via
LogImportance`:
mLogImportance = new LogImportance();
mLogImportance.Run();
Logcat output before launching a Chrome CustomTab:
[LogImportance] New importance = Foreground
Logcat output after launching a Chrome CustomTab:
[LogImportance] New importance = Foreground (Reason: Service in use)
##Nuget:
PM> Install-Package SushiHangover.Android.Support.CustomTabs.Shared
Ref: https://www.nuget.org/packages/SushiHangover.Android.Support.CustomTabs.Shared
##Xamarin Linker Friendly:
This library is linker friendly ([assembly:LinkerSafe]
) and uses conditional preservation on members ([Preserve(Conditional = true)]
)
##Chrome Custom Tabs:
Re: https://github.com/GoogleChrome/custom-tabs-client
Chrome Custom Tabs provides a way for an application to customize and interact with a Chrome Activity on Android. This makes the web content feel like being a part of the application, while retaining the full functionality and performance of a complete web browser.
###CustomTabs Reading Material
####Modernizing OAuth interactions in Native Apps for Better Usability and Security
On April 20, 2017, we will start blocking OAuth requests using web-views for all OAuth clients on platforms where viable alternatives exist.
Chrome Custom Tabs also allow the developer to pre-start Chrome and pre-fetch content for faster loading.
##License
Consult LICENSE
<style> .nuget-badge code { -moz-border-radius: 5px; -webkit-border-radius: 5px; background-color: #202020; border: 4px solid silver; border-radius: 5px; box-shadow: 2px 2px 3px #6e6e6e; color: #e2e2e2; display: block; font: 1.0em 'andale mono', 'lucida console', monospace; line-height: 1.5em; overflow: auto; padding: 15px } .nuget-badge code::before { content: "PM> " } .code { -moz-border-radius: 5px; -webkit-border-radius: 5px; background-color: #202020; border: 4px solid silver; border-radius: 5px; box-shadow: 2px 2px 3px #6e6e6e; color: #e2e2e2; display: block; font: 1.0em 'andale mono', 'lucida console', monospace; line-height: 1.5em; overflow: auto; padding: 15px } </style>