ArFragment

  • ArFragment is a base class that simplifies the setup and management of ARCore in your Android app and requires only the camera permission.

  • It provides essential methods for configuration, handling AR sessions, and managing permissions, ensuring an easy integration for developers.

  • ArFragment automatically handles requesting the camera permission and setting up an AR session, streamlining development.

  • Developers can use methods like getSessionConfiguration() and getSessionFeatures() to customize the AR session and enable specific features.

public class ArFragment

Implements AR Required ArFragment. Does not require additional permissions and uses the default configuration for ARCore.

Public Constructors

Public Methods

String[]
getAdditionalPermissions()
Returns an array of dangerous permissions that are required by the app in addition to Manifest.permission.CAMERA, which is needed by ARCore.
boolean
isArRequired()
Returns true if this application is AR Required, false if AR Optional.

Protected Methods

Config
Set<Session.Feature>
getSessionFeatures()
Specifies additional features for creating an ARCore Session.
void

Inherited Methods

Public Constructors

public ArFragment ()

Public Methods

public String[] getAdditionalPermissions ()

Returns an array of dangerous permissions that are required by the app in addition to Manifest.permission.CAMERA, which is needed by ARCore. If no additional permissions are needed, an empty array should be returned.

public boolean isArRequired ()

Returns true if this application is AR Required, false if AR Optional. This is called when initializing the application and the session.

Protected Methods

protected Config getSessionConfiguration (Session session)

Parameters
session

protected Set<Session.Feature> getSessionFeatures ()

Specifies additional features for creating an ARCore Session. See Session.Feature.

protected void handleSessionException (UnavailableException sessionException)

Parameters
sessionException