pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.26k stars 1.6k forks source link

ChromeSafariBrowser cannot open if default browser app does not support custom tabs on Android #1232

Closed addie9000 closed 2 years ago

addie9000 commented 2 years ago

Environment

Technology Version
Flutter version 2.10.5
Plugin version 5.4.3+7
Android version 6.0.0+
iOS version N/A
Xcode version N/A

Device information:

Description

Only on Android. ChromeSafariBrowser cannot open if default browser app does not support custom tabs, due to limitation of PackageManager#queryIntentActivities since Android M/N.

note: issue #391 looks like similar but probably not exactly the same.

Expected behavior:

Open with Chrome

Current behavior:

Nothing happens but output StackTrace. See Stacktrace/Logcat section.

Steps to reproduce

  1. Install browser app which does not support custom tabs such as Sleipnir https://play.google.com/store/apps/details?id=jp.co.fenrir.android.sleipnir

  2. Set installed browser as a default browser app by setting app

  3. Try to open URL by ChromeSafariBrowser

Stacktrace/Logcat

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(ChromeBrowserManager, ChromeCustomTabs is not available!, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
<asynchronous suspension>
#2      ChromeSafariBrowser.open (package:flutter_inappwebview/src/chrome_safari_browser/chrome_safari_browser.dart:112:5)
<asynchronous suspension>
#3      LoginPageState._openExternalBrowser (package:poddog2_app/ui/login/login_page.dart:253:5)
<asynchronous suspension>
github-actions[bot] commented 2 years ago

👋 @addie9000

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

Andreas409 commented 2 years ago

We are in serious need of this fix as well 😓

AnthonyGhizzo commented 2 years ago

Yes ! We need...

pichillilorenzo commented 2 years ago

Fix merged now

github-actions[bot] commented 2 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.