mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

[Android Auto] Add onClick example

Open kmadsen opened this issue 3 years ago • 2 comments

Blocked

Status is that this example is blocked until kotlin and the compile version are upgraded. So this change is built on top of this one https://github.com/mapbox/mapbox-maps-android/pull/1683. The other can be merged while this one could be merged after repo upgrades

Summary of changes

We would like to build things that use the new "onClick" function that is available in 1.3.0-beta.1.

Unfortunately, this feature is only available in beta and if we upgrade the mapbox extension library, we will also block our ability to create a stable release.

Fortunately, there is an easy solution that provides a mechanism for downstream developers to use our existing extension and adopt this new feature. The idea is to temporarily (or maybe not temporary) expose the CarMapSurfaceOwner as a public experimental class. And then a downstream developer can use MapboxCarMap.setupWithCustomCallback() to inject their own version of the SurfaceCallback. After 1.3.0 is rolled out to stable, we will be able to add the onClick to the core sdk and we may no longer need to surface this internal class.

This updates the android-auto-app to have the latest versions to showcase this ability.

https://user-images.githubusercontent.com/3021882/191576627-e3f2d9be-65dc-4748-a27c-3d3b9bdb2bc0.mov

User impact (optional)

Pull request checklist:

  • [x] Briefly describe the changes in this PR.
  • [ ] Include before/after visuals or gifs if this PR includes visual changes.
  • [ ] Write tests for all new functionality. If tests were not written, please explain why.
  • [ ] Optimize code for java consumption (@JvmOverloads, @file:JvmName, etc).
  • [ ] Add example if relevant.
  • [ ] Document any changes to public APIs.
  • [ ] Run make update-api to update generated api files, if there's public API changes, otherwise the verify-api-* CI steps might fail.
  • [ ] Update CHANGELOG.md or use the label 'skip changelog', otherwise check changelog CI step will fail.
  • [ ] If this PR is a v10.[version] release branch fix / enhancement, merge it to main firstly and then port to v10.[version] release branch.

Fixes: < Link to related issues that will be fixed by this pull request, if they exist >

PRs must be submitted under the terms of our Contributor License Agreement CLA.

kmadsen avatar Sep 21 '22 17:09 kmadsen

In order to support 1.3.0-beta.1 in an example, this repository needs to be upgraded to a new version of compileSdkVersion=33, which appears to require a newer version of kotlin. Which requires a few upgrades unrelated to this pull request

For example

* What went wrong:
Execution failed for task ':sdk-base:apiBuild'.
> Incompatible version of Kotlin metadata.
  Maximal supported Kotlin metadata version: 1.5.1,
  com/mapbox/common/MapboxCommonLogger Kotlin metadata version: 1.7.1.
  As a workaround, it is possible to manually update 'kotlinx-metadata-jvm' version in your project.
> Incompatible version of Kotlin metadata.
  Maximal supported Kotlin metadata version: 1.5.1,
  com/mapbox/maps/extension/androidauto/CarMapSurfaceOwner Kotlin metadata version: 1.7.1.
  As a workaround, it is possible to manually update 'kotlinx-metadata-jvm' version in your project.

An option, is to remove the upgrades from the android-auto-app and allow downstread to handle the upgrades. Or we can upgrade this repository to the new compileSdkVersion to unblock this change.

cc: @tobrun

kmadsen avatar Sep 21 '22 18:09 kmadsen

Thanks for flagging @kmadsen, I'm having the team look more into above requirements

tobrun avatar Sep 22 '22 11:09 tobrun