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

Android Auto integration #7

Open
ianthetechie opened this issue Sep 17, 2023 · 5 comments
Open

Android Auto integration #7

ianthetechie opened this issue Sep 17, 2023 · 5 comments
Assignees
Labels
android help wanted Help wanted from the community prod onboarding blocker Blocks production deployment of a known target user

Comments

@ianthetechie
Copy link
Contributor

No description provided.

@ianthetechie ianthetechie changed the title Support for Android Support for Android Auto Sep 17, 2023
@ianthetechie ianthetechie added the help wanted Help wanted from the community label Nov 19, 2023
@ianthetechie ianthetechie changed the title Support for Android Auto Android Auto integration Dec 5, 2023
@ianthetechie ianthetechie added the prod onboarding blocker Blocks production deployment of a known target user label Jul 17, 2024
@Archdoog Archdoog moved this to In Progress in Ferrostar Aug 24, 2024
@Archdoog Archdoog self-assigned this Aug 24, 2024
@Archdoog Archdoog moved this from In Progress to Up next in Ferrostar Aug 25, 2024
@Archdoog
Copy link
Collaborator

Some updates for discussion:

We must provide our own custom Map "surface" behind the CarApp Template(s). Unlike CarPlay on iOS where UIKit is supported for this layer, Android only seems to offer android.graphics.Canvas to draw this layer. Which from research typically results in an FPS constrained bitmap generation process. Where a Handler draws a bitmap on the canvas on the surface at a high rate. There are several avenues to go on this:

  1. There is an ongoing discussion happening from this PR Add android auto support maplibre/maplibre-native#2802. In summary, Flitsmeister posted that code in slack, this PR originated from that and now Bart has followed up to determine if Flitsmeister want's to provide the code with proper license. It sounds like they're interested in providing the code, so if that happens and an android auto map surface will likely get merged into maplibre-native. We could consider that, but have to rebuild our symbols, zoom, etc on it.
  2. This seems to be extremely tricky, but many of the pieces exist to generate a bitmap from a ComposeView. The issues with this approach are leveraging the Lifecycle, SavedStateRegistry and Window. All of which don't seem to exist as Compose expects in the CarContext/Screen. I've done several passes of this and may well be close on one of them, but it's a lot of crashing for things like null lifecycle, Window issues etc. This seems like an ideal solution, but it may well require someone with deep android platform and Compose knowledge (Aka someone building core Android Compose 😆).
  3. Lastly, we could hack these two solutions together by essentially piping an underlying MaplibreMap from the maplibre-compose-playground MapView into the Flitsmeister surface renderer. The idea being that the compose view in the Android application context (even if not visible) could essentially be running the stateful map, which is then injected into the surface as a pre-configured MaplibreMap to render as a bitmap. Janky, probably has tons of issues, but might be a way to get our rendering of symbols, without having to reconstruct it. Last note here, this may actually be a good excuse to totally re-think the MapView in the compose playground to get us one step closer to BSD-3 or MIT on that library.

@Archdoog
Copy link
Collaborator

@haysmike #2 is the one where the major questions are!

@thanhdang198
Copy link

Additional information, you can create the MapLibreMap as an XML component and it can be converted to the bitmap too. :D
Flitmeister said they will create a repo with a sample app, but they have no timeline for this yet though.

@Archdoog
Copy link
Collaborator

Flitsmeister posted their example under MIT license https://github.com/flitsmeister/MapLibre-Android-Auto-Sample. We can absolutely go this path, but I still think it's worth further exploration into the Compose view as map surface.

That'd allow us to much more effectively adapt our Android Auto map with content driven by our compose work. Using the filtsmiester sample, we'd have to do what Mapbox does where we have to recreate bitmaps of all the components like speed limit signs, the route polyline, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android help wanted Help wanted from the community prod onboarding blocker Blocks production deployment of a known target user
Projects
Status: Up next
Development

No branches or pull requests

3 participants