mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

getMapAsync() does not work when offline.

Open vfaSonnt opened this issue 10 years ago • 7 comments

The function getMapAsync() doesn't work on Fragment and SupportFragment when turn off network. On activity, it seem to work fine. Please, have a look at this problem.

vfaSonnt avatar Mar 23 '16 10:03 vfaSonnt

Thank you for reaching out and reporting your problem. I'm also noticing this without turning off network. I already created an issue related to adding a MapView programatically. Going to use #4439 in favour of this.

tobrun avatar Mar 23 '16 10:03 tobrun

@tobrun I add SupportFragment progammatically, and it work fine with the network. I get the source from github and add log at getMapAsync() on example of FragmentActivity and SupportFragmentActivity. When network is on, it work OK. Turning network off, it can not show log.

vfaSonnt avatar Mar 24 '16 01:03 vfaSonnt

@vfaSonnt thank you clarifying that for me. Besides https://github.com/mapbox/mapbox-gl-native/issues/4393 there is already a https://github.com/mapbox/mapbox-gl-native/issues/4393 ticket open that should cover your use-case. You are using the offline functionality and downloaded a region locally?

tobrun avatar Mar 24 '16 08:03 tobrun

@tobrun No, I test on Mapbox Examples source code with SupportMapFragmentActivity. Network on, it animate Camera, without network , it stay still.

mapFragment.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(@NonNull MapboxMap mapboxMap) {
                Log.d(TAG, "Map is ready");
                mapboxMap.animateCamera(CameraUpdateFactory.zoomBy(2), 3500);
            }
        });

vfaSonnt avatar Mar 24 '16 08:03 vfaSonnt

@vfaSonnt

I produced this clip with the SupportMapFragmentActivity when I have no internet, IMHO this is working as designed. If there is no internet connection we are not able to load content. If I turn on my WiFi and I have a new connection it downloads the content and calls the onMapReady callback.

Please elaborate what you expect it should do, I'm open to suggestions.

https://www.dropbox.com/s/o39dw9s6vhmwehh/device-2016-03-24-102121.mp4?dl=0

tobrun avatar Mar 24 '16 09:03 tobrun

@tobrun Thank you for your support. Sorry ,my bad. I didn't tell you about android OS. I test on Galaxy S4, OS 4.4.2, this bug will always appear. 100% appear. So I think it only happen on Android OS <5.0.

I test on Nexus5, OS 5.0. It work fine.

vfaSonnt avatar Mar 24 '16 09:03 vfaSonnt

Sometime, it happen on OS5.0 too.
https://drive.google.com/file/d/0B6QuWvSOy6oYVDVpMlpodC1Hazg/view?usp=sharing

vfaSonnt avatar Mar 24 '16 10:03 vfaSonnt