Flutterベースで開発しているAndroidアプリにTwitterのソーシャルログイン機能を実装したいのですが、Webviewでログインした後の、アプリへの独自スキームを用いたリダイレクトが以下のようにうまく行きません。
Android 10(API 29)のエミュレータでは、リダイレクトに成功するのですが、
Android 11(API 30)のエミュレータでは、Twitterでのトークン発行後のリダイレクトで"webpage not availabele net::ERR_UNKNOWN_URL_SCHEME"となってしまいます。
API29ではリダイレクト可能なことから、AndroidManifest.xml上の定義は間違っていないと思っているのですが、Android11で何か変更があったのでしょうか?
<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Registered Callback URLs in TwitterApp --> <data android:scheme="app_name"/> <!-- host is option --> </intent-filter>
リダイレクトURIは、app_name://?oauth=hogehoge...という形になっています。
Webviewの画面自体がAPI29とAPI30で異なっているので、何かここのあたりで仕様変更が入っているのだろうなとは思うのですが、実際にどこが問題になっているのかが、Android 11の変更点などを見ていても検討がつきません。
また、こちら、リダイレクトの部分ですし、Flutterというよりかは、Androidに依存する部分で何かトラブっていると思うのですが、一応、
Flutter doctor -vの実行結果です。
[✓] Flutter (Channel stable, 2.5.1, on Mac OS X 10.14.6 18G9323 darwin-x64, locale ja-JP) • Flutter version 2.5.1 at /Users/myname/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ffb2ecea52 (11 days ago), 2021-09-17 15:26:33 -0400 • Engine revision b3af521a05 • Dart version 2.14.2 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/myname/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: ???? https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: ???? https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] VS Code (version 1.60.2) • VS Code at /Users/myname/Desktop/Visual Studio Code.app/Contents • Flutter extension version 3.26.0 [✓] Connected device (2 available) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
なお、エミュレータは、
動かなかったのが、Pixcel 4 API 30 プレイストアあり、
動いたのが、Pixcel 3a API 29 プレイストアありです。
sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。