Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Snapshot blocks UI thread for 800ms #6238

Closed

Description

@mkv123

Platform: Android
Mapbox SDK version: Latest 4.2 snapshot

Steps to trigger behavior

  1. mapboxMap.snapshot(new SnaphshotReadyCallback() { public void onSnapshotReady(Bitmap snapshot){} } );

Expected behavior

Snapshot is taken while application usage remains silky smooth

Actual behavior

All animations etc stop for a significant amount of time (800ms on a high end phone, Nexus 5X).

Alternatively if I try to excute the snapshot() from a non-ui thread I get a crash.

Test code.

final long start = SystemClock.currentThreadTimeMillis();

mapboxMap().snapshot(new SnapshotReadyCallback() {
    @Override
    public void onSnapshotReady(Bitmap snapshot) {
        Log.d(TAG, "onSnapshotReady: " + (SystemClock.currentThreadTimeMillis() - start));
    }
}); 

This makes using the snapshotting pretty useless as there are very few cases where blocking the UI thread for such a long time would be ok.

Activity

  1. added
    Android
    on Sep 2, 2016
  2. modified the milestones: ios-v3.4.0, on Oct 5, 2016
  3. jfirebaugh commented on Feb 8, 2017

    @jfirebaugh
    Contributor

    Fixed in #7828.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions