1

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

More info:

We are using IndexedStack to show the map and other tabs This error occurs on both android and ios In every 'resumed' we are setting this:

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
   switch (state) {
   case AppLifecycleState.resumed:

    final brightness = WidgetsBinding.instance.window.platformBrightness;
    final hereMapScheme = widget._mapSchemeFormatter.format(mapSchemeUiModel, brightness);
    _hereMapController.mapScene.loadSceneForMapScheme(hereMapScheme, (p0) { });
    break;

    (...)
    }
}

System info:

  • HERE SDK for Flutter (version: 4.12.7)
  • Flutter version: 3.3.4

Newest system info:

  • HERE SDK for Flutter (version: 4.13.2)
  • Flutter version: 3.3.9

Device:

  • Samsung Galaxy S9+

Steps to reproduce:

Open app -> map is OK Put app into background, without it being killed by the system Resume the app after a while (~20 min) 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.

WebEyeDev
  • 11
  • 2
  • Have you checked if the hereMapScheme is valid? What value does it have when screen is empty? Do you get any error? Is it intentionally, that your callback does not include any error handling? And: Why do you reload the map scene at all? This should not be necessary when the app is resumed ... – Nusatad Mar 09 '23 at 22:06

1 Answers1

0

I have the same experience. Steps to reproduction:

  • launch the app,
  • put it in the background,
  • turn off the display,
  • wait a few seconds,
  • turn the display back on,
  • bring the application to the foreground.

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

I've created two screenshots: https://i.stack.imgur.com/CcVDy.jpg.

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> with WidgetsBindingObserver {

  @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;
      }
    });
  }

}
wyzard
  • 543
  • 5
  • 17
  • 1
    Related issue for Google Maps: https://stackoverflow.com/questions/59374010/flutter-googlemap-is-blank-after-resuming-from-background/59435683#59435683 – Nusatad Apr 12 '23 at 20:34