WemapGeoARComposeSDK

Jetpack Compose support for the Wemap GeoAR SDK.

Overview

WemapGeoARComposeSDK adds a single composable, WemapGeoAR, over WemapGeoARSDK's GeoARView. It is a separate artifact for the same reason as WemapMapComposeSDK: @Composable declarations in WemapGeoARSDK would force the Compose runtime onto every consumer, View-based apps included.

Everything the SDK offers is reached through the AR view handed to onLoaded. There is no camera state here — unlike the Map SDK's WemapMap — because the AR camera follows the device and the user's position rather than being app state to drive.

import com.getwemap.sdk.geoar.compose.WemapGeoAR

@Composable
fun ARScreen(session: CoreSession) {

var arView by remember { mutableStateOf<GeoARView?>(null) }

WemapGeoAR(
session = session,
modifier = Modifier.fillMaxSize(),
onLoaded = { view ->
arView = view
view.locationManager.locationSource = locationSource
},
onFailed = { error -> Log.e("GeoAR", "Failed to load the AR view", error) }
)

val coordinate by (arView?.locationManager?.coordinates ?: emptyFlow())
.collectAsStateWithLifecycle(null)
}

AR requires camera access — declare android.permission.CAMERA in your manifest and request the permission before this composable enters composition. The scene also needs a LocationSource from WemapPositioningSDK attached to locationManager to be positioned at all.

Hoist the session into a ViewModel rather than a remember, and call session.deinit() from that owner; the AR view itself is torn down when it leaves composition.

This module requires minSdk 24 and Java 17, matching its ARCore/SceneView dependencies.

Packages

Link copied to clipboard