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

Implement snapshot feature in maps API #1617

Closed
mar-v-in opened this issue Nov 23, 2021 · 5 comments
Closed

Implement snapshot feature in maps API #1617

mar-v-in opened this issue Nov 23, 2021 · 5 comments

Comments

@mar-v-in
Copy link
Member

The current implementation of the maps API lacks support for the snapshot() functionality.

https://github.com/microg/GmsCore/blob/master/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt#L483

This is a requirement for location sharing in Signal messenger.

@khao-soi
Copy link

Is there an easy way to test this function? Last night I tried to implement this method, but I lack experience in kotlin and android development.

@mar-v-in
Copy link
Member Author

You can try out most maps features (including the snapshot feature) in the maps api demo app: https://github.com/googlemaps/android-samples/releases/tag/v1.6.0

@khao-soi
Copy link

khao-soi commented Dec 13, 2021

So, I tried a few things here. When I connect my phone (LOS + microG) and attach the debugger to its com.google.android.gms process it doesn't seem to hit any breakpoint.
When I create a virtual device (Nexus 6 for no specific reason) based on the Android 10.0 microG Image and start the maps demo app I get "Maps SDK for Android Demos (Kotlin) won't run without Google Play Services". Self-Check has everything besides Phonesky and GSF.

Any ideas?

@mar-v-in
Copy link
Member Author

For using microG in Android Emulator, check https://github.com/microg/GmsCore/wiki/Development-Tools#using-the-emulator

For debugging apps that use Maps API, you need to attach the debugger to the app using Maps, not com.google.android.gms.

@mar-v-in mar-v-in modified the milestones: 0.2.23, 0.2.24, 0.2.25 Jan 27, 2022
@mar-v-in mar-v-in modified the milestones: 0.2.25, 0.2.26 Aug 6, 2022
@mar-v-in mar-v-in modified the milestones: 0.2.26, 0.2.27 Nov 4, 2022
@mar-v-in mar-v-in modified the milestones: 0.2.27, 0.2.28 Dec 27, 2022
@fynngodau
Copy link
Contributor

fynngodau commented Jun 17, 2023

Snapshots are now implemented:

override fun snapshot(callback: ISnapshotReadyCallback, bitmap: IObjectWrapper?) {
val map = map
if (map == null) {
// Snapshot cannot be taken
Log.e(TAG, "snapshot could not be taken because map is null")
runOnMainLooper { callback.onBitmapWrappedReady(ObjectWrapper.wrap(null)) }
} else {
if (!isStarted) {
Log.w(TAG, "Caller did not call onStart() before taking snapshot. Calling onStart() now, for snapshot not to fail.")
// Snapshots fail silently if onStart had not been called. This is the case with Signal.
onStart()
isStarted = true
}
Log.d(TAG, "taking snapshot now")
map.snapshot {
runOnMainLooper {
Log.d(TAG, "snapshot ready, providing to application")
callback.onBitmapWrappedReady(ObjectWrapper.wrap(it))
}
}
}
}

Re. sharing locations in Signal (signalapp/Signal-Android#12723), the next blocker is #1960.

@mar-v-in mar-v-in closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants