mapbox / mapbox/mapbox-maps-android

Lag on move map or zoom

Open
#2,512 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the lag on the Lenovo TB-8505X running Android 10 with Maps SDK 1.7.2, using the LoadMapBoxMap implementation shown in the issue. Review the linked video and compare behavior between the reported version 9 and version 11; done means documenting a reliable reproduction and identifying a specific, actionable cause or regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.