heremaps / here-sdk-examples

Android, iOS and Flutter example apps for the HERE SDK 4.x (Lite Edition, Explore Edition, Navigate Edition)
https://developer.here.com/products/here-sdk
Apache License 2.0
171 stars 135 forks source link

[Flutter] Empty screen when resuming from background #211

Closed WebeyeDev closed 1 year ago

WebeyeDev commented 1 year ago

Hi.

We have new use case and problem. When the application returns from the background, there is a empty screen instead of the map.

Steps to reproduce:

Behaviour:

I couldn't find a pattern yet as to how long the app needs to be in the background or how much load the device needs to be under (I think it is more likely to happen if the app stays in the background for a longer time). The map works in foreground and after a short background.

More info:

HERE-SDK-Support-Team commented 1 year ago

Thanks for reporting, but please file a ticket for such bugs via our help desk: https://developer.here.com/help. This repository and its issue tracking are meant for issues with the hosted example apps and this issue does not look like it is related to any example app hosted in this repository. Via help desk you can share your account details and example code, so it will be easier and faster for us to help you. Thanks!

WebeyeDev commented 1 year ago

Hello @HERE-SDK-Support-Team ,

https://stackoverflow.com/questions/74979550/here-sdk-for-flutter-empty-screen-when-resuming-from-background

This is my report but no one has helped me yet. Please give me some solution or a workaround.

Thank you

HERE-SDK-Support-Team commented 1 year ago

Hello @WebeyeDev, sorry to hear. Are you calling _hereMapController.mapScene.loadSceneForMapScheme for a specific reason in onResume state?

It would be great to see if you can reproduce this issue with the camera_app example (or any other app that uses a StatefulWidget) from this repository - then we can isolate the issue and know if it is related to your IndexedStack mechanism or other app code that might cause this.

If the app runs in background, it can always happen that the app is get killed due to poor resources, so it would be also helpful to see the full logs. As a guideline please see this checklist. Thanks.

wyzard commented 1 year ago

I have the same experience. Steps to reproduction:

The map then disappears and is replaced by a black rectangle.

I've created two screenshots: https://imgur.com/a/R3o9yKp.

Android 11, HERE SDK for Flutter 4.13.2. I've tried with auto-initialization and manual SDK initialization too, the result is the same.

The code I use:

    import 'package:flutter/material.dart';
    import 'package:here_sdk/core.dart';
    import 'package:here_sdk/mapview.dart';

    void main() {
      SdkContext.init(IsolateOrigin.main);
      runApp(MyApp());
    }

    class MyApp extends StatefulWidget {
      @override
      State<StatefulWidget> createState() {
        return MyAppState();
      }
    }

    class MyAppState extends State<MyApp> {

      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'HERE performance test!',
          home: HereMap(onMapCreated: _onMapCreated),
        );
      }

      void _onMapCreated(HereMapController hereMapController) async {
        hereMapController.mapScene.loadSceneForMapScheme(MapScheme.normalDay, (MapError? error) {
          if (error != null) {
            print('Map scene not loaded. MapError: ${error.toString()}');
            return;
          }
        });
      }

    }
HERE-SDK-Support-Team commented 1 year ago

Thanks, @wyzard. Could it be that the HERE SDK is no longer initialized? It would be great if you can attach the logs.

wyzard commented 1 year ago

Thank you for your answer @HERE-SDK-Support-Team. HereMapController isValidproperty reports true all the time. I tried the MapViewLifecycleListener too to see what's happening with MapView:

  1. attach
  2. pause
  3. resume (there is no onDestroy call)

The map library has been updated to the latest version: HERE SDK for Flutter (explore Edition) - Version 4.13.4.0

Here is a log I see:

D/ActivityThread(14522): Won't deliver top position change in state=5
W/DisplayEventDispatcher(14522): dispatcher 0x6f3ca4ec60 ~ ignoring unknown event type 0x736f6674
D/ZrHung.AppEyeUiProbe(14522): restart watching
I/harp-sdk(14522): [INFO ] harp-sdk - Render loop thread resumed
W/DisplayEventDispatcher(14522): dispatcher 0x6f4989b8e0 ~ ignoring unknown event type 0x736f6674
I/flutter (14522): resumed
W/Thread-49(14522): type=1400 audit(0.0:235095): avc: denied { search } for pid=14522 name="/" dev="configfs" ino=9199 scontext=u:r:untrusted_app:s0:c77,c259,c512,c768 tcontext=u:object_r:configfs:s0 tclass=dir permissive=0
D/mali_winsys(14522): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/mali_winsys(14522): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/HwViewRootImpl(14522): removeInvalidNode all the node in jank list is out of time
I/RmeSchedManager(14522): init Rme, version is: v1.0
I/RtgSchedEvent(14522): current pid:14522 AppType:-1
D/DecorView(14522): showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager(14522): startInputReason = 1
W/HwRemoteInputMethodManager(14522): isCasting false because IHwDistributedWindowManager is invalid.
I/magma-scene(14522): [INFO ] magma-scene - load scene geoviz/oslo/scenes/normal.day.scene.json: 0.116506
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 1 line
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 1 line
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 1 line
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 4 lines
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 1 line
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 2 lines
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 4 lines
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 5 lines
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
I/chatty  (14522): uid=10845(eu.webeye.android.dispatcherapp) Thread-49 identical 7 lines
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
E/magma-graphics-opengl(14522): [ERROR] magma-graphics-opengl - OpenGL error: invalid enum
HERE-SDK-Support-Team commented 1 year ago

Thank you, @wyzard. We track this issue internally under this ticket number: #16810.

WebeyeDev commented 1 year ago

Thank you for your answer @HERE-SDK-Support-Team ,

How will we know when the problem is fixed? On the product site isn't anywhere this known issue. https://developer.here.com/documentation/flutter-sdk-explore/4.13.4.0/release_notes/topics/notes_explore.html#version-41340

Have a nice day, thanks.

HERE-SDK-Support-Team commented 1 year ago

We will announce it in this thread. So far there is no known issue. If we can verify that this is an issue that can be handled on app side, we will reopen the issue.

WebeyeDev commented 1 year ago

Some devices that have the problem:

fyi: @HERE-SDK-Support-Team

wyzard commented 1 year ago

Some devices that have the problem:

* Samsung Galaxy S9+

* Samsung Galaxy S10

* Samsung Galaxy S20FE

fyi: @HERE-SDK-Support-Team

Sorry, I forgot to write mine: Huawei P30 Pro.

WebeyeDev commented 1 year ago

Hi @HERE-SDK-Support-Team

I understand that you may be busy and would appreciate it if you could let me know if there are any additional steps I need to take to facilitate the process. Thank you for your time and consideration and I look forward to hearing from you soon.

HERE-SDK-Support-Team commented 1 year ago

Hi @WebeyeDev, our internal ticket is still active. Unfortunately, we cannot announce a due date yet. Sorry, for the inconvenience.

HERE-SDK-Support-Team commented 1 year ago

Additional information:

A similar issue with Google Maps: https://stackoverflow.com/questions/59374010/flutter-googlemap-is-blank-after-resuming-from-background/59435683#59435683

See also: https://github.com/flutter/flutter/issues/98865

@wyzard Thanks for sharing this via: https://github.com/heremaps/here-sdk-examples/issues/222.

WebeyeDev commented 1 year ago

Hi @HERE-SDK-Support-Team

Thanks guys, we really appreciate it. We are already very excited. 🍻😉👍

HERE-SDK-Support-Team commented 1 year ago

We have good news, the issue has been reported as fixed (#16810). Please update to HERE SDK 4.14.3 which will contain the fix. This release is planned for next week. Hope this helps.

PuffPastry commented 1 year ago

Hi, unfortunately we are still experiencing this issue.

SDK Version 4.15.3

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.3, on macOS 13.5.2 22G91
    darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android
    SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Community Edition (version 2022.3.3)
[✓] VS Code (version 1.82.0)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!
HERE-SDK-Support-Team commented 1 year ago

Thanks, @PuffPastry - we'll repopen the ticket. But can you ensure to test again with a supported Flutter version? 3.13.3 is not (yet) supported.

The latest supported Flutter version is 3.10.5 and Dart 3.0.5.

PuffPastry commented 1 year ago

Thanks for the quick action! Unfortunately the issue remained after the downgrade to 3.10.3. I have also tried out the latest update to the SDK: Flutter Navigate Edition 4.15.4, with the same result. It is very inconsistent and hard to reproduce sometimes, othertimes it happens more readily.

All help is very much appreciated, as we are looking to launch soon, but feel that this might cause a delay, as the user experience is unpleasant. A workaround to reload the widget is not ideal either from that perspective, as they all cause a drastic redrawing of the widget, with considerable jank.

HERE-SDK-Support-Team commented 1 year ago

Hi @PuffPastry, sorry for the confusion.

This issue is actually mentioned in our troubleshoot sections. Please follow this guide to fix the issue: https://developer.here.com/documentation/flutter-sdk-navigate/dev_guide/topics/maps.html#choose-surface-or-texture-view-on-android-devices

Basically, depending to the Android version on the device, use the MapRenderMode.texture to fix this issue.

If this does not address the bug, please leave a reply. Thanks!