ARCore

class ARCore(val onSessionCreated: (session: Session) -> Unit, val onSessionResumed: (session: Session) -> Unit, val onSessionPaused: (session: Session) -> Unit, val onArSessionFailed: (Exception) -> Unit, val onSessionConfigChanged: (session: Session, config: Config) -> Unit)

Manages an ARCore Session using the Android Lifecycle API. Before starting a Session, this class requests installation of Google Play Services for AR if it's not installed or not up to date and asks the user for required permissions if necessary.

Constructors

Link copied to clipboard
constructor(onSessionCreated: (session: Session) -> Unit, onSessionResumed: (session: Session) -> Unit, onSessionPaused: (session: Session) -> Unit, onArSessionFailed: (Exception) -> Unit, onSessionConfigChanged: (session: Session, config: Config) -> Unit)

Properties

Link copied to clipboard
Link copied to clipboard

Enable/Disable Google Play Services for AR availability check, auto install and update

Link copied to clipboard
Link copied to clipboard
lateinit var features: Set<Session.Feature>
Link copied to clipboard
Link copied to clipboard
val onSessionConfigChanged: (session: Session, config: Config) -> Unit
Link copied to clipboard
val onSessionCreated: (session: Session) -> Unit
Link copied to clipboard
val onSessionPaused: (session: Session) -> Unit
Link copied to clipboard
val onSessionResumed: (session: Session) -> Unit

Functions

Link copied to clipboard

Check to see if we're on a device where ARCore can be installed

Link copied to clipboard
Link copied to clipboard
fun checkInstall(activity: ComponentActivity, installRequested: Boolean): Boolean

Checks if ARCore is already installed or attempts to request an install otherwise.

Link copied to clipboard
fun create(context: Context, activity: ComponentActivity?, features: Set<Session.Feature>)
Link copied to clipboard
fun createSession(context: Context)
Link copied to clipboard
fun destroy()

Review the API reference for important considerations before calling close() in apps with more complicated lifecycle requirements: Session.close

Link copied to clipboard

Check to see we have the necessary permissions for this app.

Link copied to clipboard
fun install(activity: ComponentActivity, installRequested: Boolean): Boolean

Returns true if we attempted to request an install.

Link copied to clipboard
fun isInstalled(context: Context): Boolean

Check to see we have the necessary permissions for this app.

Link copied to clipboard
fun onException(exception: Exception)
Link copied to clipboard
fun pause()
Link copied to clipboard
fun resume(context: Context, activity: ComponentActivity?)