Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag on move map or zoom #2512

Open
milenpav opened this issue Nov 6, 2024 · 5 comments
Open

Lag on move map or zoom #2512

milenpav opened this issue Nov 6, 2024 · 5 comments
Labels
bug 🪲 Something isn't working

Comments

@milenpav
Copy link

milenpav commented Nov 6, 2024

Environment

  • Android OS version: Android 10
  • Devices affected: Lenovo TB-8505X
  • Maps SDK Version:1.7.2

I update from version 9 to v 11
but map is verry laggy on this device when is move or zoom.

This is My code ov implementation

private void LoadMapBoxMap(FrameLayout mapLayout) {
        ((DriverApplication) mActivity.getApplication()).setMapView(MAP_VIEW_MAPBOX);

        mMapBoxView = new com.mapbox.maps.MapView(mActivity.getApplicationContext());
        mMapboxMap=mMapBoxView.getMapboxMap();

        var camera = new CameraOptions.Builder()
                .center(Point.fromLngLat(27.916077,43.213116))
                .pitch(50.0)
                .zoom(18.0)
                .build();

        mMapboxMap.setCamera(camera);
        int currentNightMode = DriverApplication.getInstance().getThemeMode();
        mMapboxMap.loadStyle(currentNightMode == AppCompatDelegate.MODE_NIGHT_YES ?
                mActivity.getResources().getString(R.string.mapbox_style_dark) :
                mActivity.getResources().getString(R.string.mapbox_style_light), new Style.OnStyleLoaded() {
            @Override
            public void onStyleLoaded(@NonNull Style style) {
                   style.addImage (MARKER_ADDRESS, generateBitmap(R.drawable.address_marker));
                style.addImage(MARKER_ACCIDENT,  generateBitmap(R.drawable.marker_car_accident));
                style.addImage(MARKER_CLIENT, generateBitmap(R.drawable.marker_client));
                style.addImage(MARKER_CLOSED_ROAD, generateBitmap(R.drawable.marker_closed_road));
                style.addImage(MARKER_POLICE, generateBitmap(R.drawable.marker_police));
                style.addImage(MARKER_IAAA, generateBitmap(R.drawable.marker_iaaa));
                style.addImage(MARKER_REQUEST, generateBitmap(R.drawable.marker_request));
                style.addImage(MARKER_RIDE, generateBitmap(R.drawable.marker_ride));
                style.addImage(MARKER_TRAFFIC, generateBitmap(R.drawable.marker_traffic));
                style.addImage(MARKER_ICE, generateBitmap(R.drawable.marker_danger_road));
                style.addImage(MARKER_CAMERA, generateBitmap(R.drawable.marker_camera));

                enableLocationComponent();
            }
        });
        mapLayout.addView(mMapBoxView);
}
  private void enableLocationComponent() {

        if (ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
                ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(mActivity, new String[]{
                    Manifest.permission.ACCESS_FINE_LOCATION,
                    Manifest.permission.ACCESS_COARSE_LOCATION},0);
            return;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
                &&ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED ) {
            ActivityCompat.requestPermissions(mActivity, new String[]{
                    Manifest.permission.ACCESS_BACKGROUND_LOCATION,
            }, 0);
            return;
        }
        mLocationComponent = mMapBoxView.getPlugin(Plugin.MAPBOX_LOCATION_COMPONENT_PLUGIN_ID);
        mLocationComponent.initialize();
}

Additional links and references

Link to video
https://files.fm/u/mkhjsnaqfu

@milenpav milenpav added the bug 🪲 Something isn't working label Nov 6, 2024
@flasher297
Copy link
Contributor

Thank you for the report.
Do you face this issue only on one device (Android 10, Lenovo TB-8505X)?
It would be very helpful if you could provide us an example that reproduces a bug.

@milenpav
Copy link
Author

Yes only in device Android 10, Lenovo TB-8505X in devie Xiaomi 2109119DG there is no such kind of lag. also I noticed that lag is when zoom level is 6+. Also i try with debug with profiler thee has a free ram and CPU
image

@milenpav
Copy link
Author

I try it also on LENOVO Lenovo TB-8504X wich is older device and with 1 Gb Ram and there is no Lag

@flasher297
Copy link
Contributor

Seems that it's device device-specific bug.
To continue with it we still need to have a reproducible example.

@milenpav
Copy link
Author

milenpav commented Nov 14, 2024

https://github.com/milenpav/MapboxTest
here i make reproducible example of test app
you need to change in strings.xml
<string name="mapbox_access_token" translatable="false">mapAccesToken</string>
and in gradle.properties
MAPBOX_DOWNLOADS_TOKEN=MapToken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants