-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
good first issueWell scoped and good for newcomersWell scoped and good for newcomers
Description
What happened?
Right now the bearing value comes from:
Android -> AndroidLocation::bearing
iOS -> CLLocation::course
I tested the demo on a physical iOS device, the bearing does not look quite accurate and agile like in other maps (Google Maps, Apple Maps etc). Basically I could not get the cone rotate at all, it was always looking North.
Find the reasons why, I bet they use other sensors for this to work, like:
ChatGpt:
Magnetometer → acts like a digital compass, detecting the Earth’s magnetic field.
Accelerometer → senses gravity to know which way is “down”.
Gyroscope → tracks rotation and changes in orientation.
Affected Platforms
- Android
- iOS
- Desktop (JVM)
- Browser (JS)
- Browser (Wasm)
Platform Version
iOS 26
Library Version
0.12.1
Sample Code
val cameraState = rememberCameraState()
val locationProvider = rememberDefaultLocationProvider()
val locationState = rememberUserLocationState(locationProvider)
LocationTrackingEffect(locationState = locationState) {
val position = locationState.location?.position ?: return@LocationTrackingEffect
cameraState.position = cameraState.position.copy(target = position, zoom = 17.0)
}
Box(
modifier = Modifier.fillMaxSize(),
) {
AnimatedVisibility(locationState.location?.position != null) {
MaplibreMap(
modifier = Modifier.fillMaxSize(),
baseStyle = BaseStyle.Uri("https://mafrend.com/map/mafrend-style.json"),
options = MapOptions(ornamentOptions = OrnamentOptions.OnlyLogo),
cameraState = cameraState
) {
Logger.withTag("debugit").i { "locationState.location?.accuracy: ${locationState.location?.accuracy}" }
LocationPuck(
idPrefix = "user-location",
locationState = locationState,
cameraState = cameraState
)
}
}
}
Metadata
Metadata
Assignees
Labels
good first issueWell scoped and good for newcomersWell scoped and good for newcomers