I have configured my app to sign in to ArcGIS online via OAuth according to sample. When I try to access portal (namely, get token) on Android emulator, I experience the following behaviour.
- Window with standard ArcGIS web view asking for username/password appears
- I fill required info and click "Sign In" button
- Window disappears but immediately appears again with empty UN/PW fields and without any errors
- If I fill UN/PW fields and click "Sign In" again, I see step #3 repeated again
- If I click "Cancel", I see step #3 repeated again
- If I click "X" button in top left, it returns back to my application without any error in log
This is very confusing behaviour. Nevertheless, token in received correctly and is available in my code.
Here is what I see in Flutter log:
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk
D/FlutterLocationService(25127): Creating service.
D/FlutterLocationService(25127): Binding to location service.
Debug service listening on ws://127.0.0.1:54747/7nhbvLo_1Ck=/ws
Syncing files to device sdk gphone64 x86 64...
D/ProfileInstaller(25127): Installing profile for com.esri.[my-app-id]
I/PlatformViewsController(25127): Using hybrid composition for platform view: 0
D/CompatibilityChangeReporter(25127): Compat change id reported: 236825255; UID 10191; state: ENABLED
E/EGL_emulation(25127): eglQueryContext 32c0 EGL_BAD_ATTRIBUTE
E/EGL_emulation(25127): tid 25127: eglQueryContext(2146): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/MapViewRenderer(25127): Starting pulse
I/flutter (25127): Getting token
I/flutter (25127): Creating OAuthUserCredential
D/EGL_emulation(25127): app_time_stats: avg=3309.65ms min=164.96ms max=6454.35ms count=2
D/EGL_emulation(25127): app_time_stats: avg=3305.84ms min=166.88ms max=6444.81ms count=2
D/EGL_emulation(25127): app_time_stats: avg=1767.54ms min=59.52ms max=6441.73ms count=4
I/MapViewRenderer(25127): Stopping pulse
D/EGL_emulation(25127): app_time_stats: avg=243.07ms min=17.80ms max=1832.81ms count=9
D/EGL_emulation(25127): app_time_stats: avg=243.33ms min=14.82ms max=1836.10ms count=9
D/EGL_emulation(25127): app_time_stats: avg=242.64ms min=19.78ms max=1825.41ms count=9
I/flutter (25127): Getting token info
I/flutter (25127): accessToken: 3NKHt6...
I/MapViewRenderer(25127): Resumed by user. Texture view available: true
W/OpenGLRenderer(25127): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
W/OpenGLRenderer(25127): Failed to initialize 101010-2 format, error = EGL_SUCCESS
E/OpenGLRenderer(25127): Unable to match the desired swap behavior.
D/EGL_emulation(25127): app_time_stats: avg=24751.84ms min=24751.84ms max=24751.84ms count=1
D/EGL_emulation(25127): app_time_stats: avg=24763.88ms min=24763.88ms max=24763.88ms count=1
I/MapViewRenderer(25127): Starting pulse
D/EGL_emulation(25127): app_time_stats: avg=27904.54ms min=157.61ms max=55651.45ms count=2
D/EGL_emulation(25127): app_time_stats: avg=27900.98ms min=150.63ms max=55651.33ms count=2
D/EGL_emulation(25127): app_time_stats: avg=18624.16ms min=93.41ms max=55642.82ms count=3
Notes:
- OAuth credentials are valid and works well with ArcGIS Maps SDK for Kotlin/Swift.
- I use currently released version of ArcGIS SDK for Flutter (200.6.0+4426), the latest Flutter SDK (3.27.0), and the latest Dart version (3.6.0).
- This workflow works correctly for iOS
- Android simulator versions are 12 and 14
Here is the video describing what's happening.