Skip to content

HmsMaps: Modify the Snapshot method#3200

Open
DaVinci9196 wants to merge 3 commits intomicrog:masterfrom
DaVinci9196:fix_maps_snapshot_error
Open

HmsMaps: Modify the Snapshot method#3200
DaVinci9196 wants to merge 3 commits intomicrog:masterfrom
DaVinci9196:fix_maps_snapshot_error

Conversation

@DaVinci9196
Copy link
Contributor

Adjust the snapshot method to return the bitmap correctly.
e.g. Timestamp Camera<com.jeyluta.timestampcamerafree>

@mar-v-in mar-v-in added this to the 0.3.13 milestone Jan 10, 2026

override fun snapshot(callback: ISnapshotReadyCallback, bitmap: IObjectWrapper?) = afterInitialize {
Log.d(TAG, "snapshot")
val hmsBitmap = bitmap.unwrap<Bitmap>() ?: return@afterInitialize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not ignore bitmap if it's provided. Only if bitmap is null or its dimensions (width + height) don't actually match the map view dimensions, you can ignore it, otherwise for performance reason, please use the bitmap provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Log.d(TAG, "taking snapshot now")
val hmsCallback = HuaweiMap.SnapshotReadyCallback { result -> runOnMainLooper {
Log.d(TAG, "take snapshot end. $result")
callback.onBitmapWrappedReady(ObjectWrapper.wrap(result))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of onBitmapReady or onBitmapWrappedReady depends on the client version code (provided in initV2 call). Only version codes >= 4000000 support onBitmapWrappedReady. Given that most apps are using those, always using onBitmapWrappedReady will likely work except for a few very old apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants