예제 #1
0
        internal Task <bool> TryOpenUri(string uri)
        {
            var intent = ResolveMapIntent(uri);

            var canStart = PlatformUtils.IsIntentSupported(intent);

            if (canStart)
            {
                Platform.AppContext.StartActivity(intent);
            }

            return(Task.FromResult(canStart));
        }
예제 #2
0
        static void LaunchExternalBrowser(BrowserLaunchOptions options, AndroidUri?nativeUri)
        {
            var intent = new Intent(Intent.ActionView, nativeUri);
            var flags  = ActivityFlags.ClearTop | ActivityFlags.NewTask;

#if __ANDROID_24__
            if (OperatingSystem.IsAndroidVersionAtLeast(24))
            {
                if (options.HasFlag(BrowserLaunchFlags.LaunchAdjacent))
                {
                    flags |= ActivityFlags.LaunchAdjacent;
                }
            }
#endif
            intent.SetFlags(flags);

            if (!PlatformUtils.IsIntentSupported(intent))
            {
                throw new FeatureNotSupportedException();
            }

            Application.Context.StartActivity(intent);
        }
예제 #3
0
        Task <bool> PlatformCanOpenAsync(Uri uri)
        {
            var intent = new Intent(Intent.ActionView, AndroidUri.Parse(uri.OriginalString));

            return(Task.FromResult(PlatformUtils.IsIntentSupported(intent)));
        }