[英]How do I bypass Android intent filter when my app is open and user has selected to “always” open domain in my app?
My app intercepts my entire website domain. 我的应用拦截了我的整个网站域。 However, I occasionally cannot support a particular page in app.
但是,有时我无法支持应用程序中的特定页面。 When this happens, I want to redirect the user back to the browser.
发生这种情况时,我想将用户重定向回浏览器。 Unfortunately, if the users has selected "Always" to open my app with this domain (rather than selecting "Only Once"), I get stuck in a redirect loop.
不幸的是,如果用户选择“始终”来使用该域打开我的应用程序(而不是选择“仅一次”),我将陷入重定向循环。
Start the original intent 开始原始意图
Intent intent = null; try { // #1 intent = new Intent(Intent.ActionView); intent.SetData(Android.Net.Uri.Parse(url)); // #2 Intent tempIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://")); // #3 var resolution = activity.PackageManager.ResolveActivity(tempIntent, Android.Content.PM.PackageInfoFlags.MatchDefaultOnly); // #4 intent.SetComponent(new ComponentName( resolution.ActivityInfo.ApplicationInfo.PackageName, resolution.ActivityInfo.Name)); // #5 StartActivity(intent); } catch { }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.