AI-generated Key Takeaways
-
ArFragmentis 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.
-
ArFragmentautomatically handles requesting the camera permission and setting up an AR session, streamlining development. -
Developers can use methods like
getSessionConfiguration()andgetSessionFeatures()to customize the AR session and enable specific features.
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 |
getSessionConfiguration(Session session)
|
| Set<Session.Feature> |
getSessionFeatures()
Specifies additional features for creating an ARCore
Session. |
| void |
handleSessionException(UnavailableException sessionException)
|
Inherited Methods
| abstract 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.
|
| ArSceneView |
getArSceneView()
Gets the ArSceneView for this fragment.
|
| Boolean |
getCanRequestDangerousPermissions()
If true,
requestDangerousPermissions() returns without doing anything, if false
permissions will be requested
|
| PlaneDiscoveryController |
getPlaneDiscoveryController()
Gets the plane discovery controller, which displays instructions for how to scan for planes.
|
| abstract Config |
getSessionConfiguration(Session session)
|
| abstract Set<Session.Feature> |
getSessionFeatures()
Specifies additional features for creating an ARCore
Session. |
| TransformationSystem |
getTransformationSystem()
Gets the transformation system, which is used by
TransformableNode for detecting
gestures and coordinating which node is selected. |
| abstract void |
handleSessionException(UnavailableException sessionException)
|
| final void |
initializeSession()
Initializes the ARCore session.
|
| abstract boolean |
isArRequired()
Returns true if this application is AR Required, false if AR Optional.
|
| TransformationSystem |
makeTransformationSystem()
Creates the transformation system used by this fragment.
|
| View | |
| void | |
| void | |
| void |
onPause()
|
| void |
onPeekTouch(HitTestResult hitTestResult, MotionEvent motionEvent)
Called when a touch event is dispatched to a scene.
|
| void |
onRequestPermissionsResult(int requestCode, String[] permissions, int[] results)
Receives the results for permission requests.
|
| void |
onResume()
|
| void | |
| void |
onWindowFocusChanged(boolean hasFocus)
|
| void |
requestDangerousPermissions()
Starts the process of requesting dangerous permissions.
|
| final boolean | |
| void |
setCanRequestDangerousPermissions(Boolean canRequestDangerousPermissions)
If true,
requestDangerousPermissions() returns without doing anything, if false
permissions will be requested
|
| void |
setOnSessionInitializationListener(BaseArFragment.OnSessionInitializationListener onSessionInitializationListener)
Registers a callback to be invoked when the ARCore Session is initialized.
|
| void |
setOnTapArPlaneListener(BaseArFragment.OnTapArPlaneListener onTapArPlaneListener)
Registers a callback to be invoked when an ARCore Plane is tapped.
|
| void |
setupSelectionRenderable(FootprintSelectionVisualizer selectionVisualizer)
|
| void | |
| final boolean |
equals(Object arg0)
|
| final FragmentActivity |
getActivity()
|
| boolean |
getAllowEnterTransitionOverlap()
|
| boolean |
getAllowReturnTransitionOverlap()
|
| final Bundle |
getArguments()
|
| final FragmentManager |
getChildFragmentManager()
|
| Context |
getContext()
|
| ViewModelProvider.Factory |
getDefaultViewModelProviderFactory()
|
| Object |
getEnterTransition()
|
| Object |
getExitTransition()
|
| final FragmentManager |
getFragmentManager()
|
| final Object |
getHost()
|
| final int |
getId()
|
| LayoutInflater |
getLayoutInflater(Bundle arg0)
|
| final LayoutInflater |
getLayoutInflater()
|
| Lifecycle |
getLifecycle()
|
| LoaderManager |
getLoaderManager()
|
| final Fragment |
getParentFragment()
|
| final FragmentManager |
getParentFragmentManager()
|
| Object |
getReenterTransition()
|
| final Resources |
getResources()
|
| final boolean |
getRetainInstance()
|
| Object |
getReturnTransition()
|
| final SavedStateRegistry |
getSavedStateRegistry()
|
| Object |
getSharedElementEnterTransition()
|
| Object |
getSharedElementReturnTransition()
|
| final String |
getString(int arg0, Object... arg1)
|
| final String |
getString(int arg0)
|
| final String |
getTag()
|
| final Fragment |
getTargetFragment()
|
| final int |
getTargetRequestCode()
|
| final CharSequence |
getText(int arg0)
|
| boolean |
getUserVisibleHint()
|
| View |
getView()
|
| LifecycleOwner |
getViewLifecycleOwner()
|
| LiveData<LifecycleOwner> |
getViewLifecycleOwnerLiveData()
|
| ViewModelStore |
getViewModelStore()
|
| final boolean |
hasOptionsMenu()
|
| final int |
hashCode()
|
| static Fragment | |
| static Fragment | |
| final boolean |
isAdded()
|
| final boolean |
isDetached()
|
| final boolean |
isHidden()
|
| final boolean |
isInLayout()
|
| final boolean |
isMenuVisible()
|
| final boolean |
isRemoving()
|
| final boolean |
isResumed()
|
| final boolean |
isStateSaved()
|
| final boolean |
isVisible()
|
| void |
onActivityCreated(Bundle arg0)
|
| void |
onActivityResult(int arg0, int arg1, Intent arg2)
|
| void |
onAttach(Activity arg0)
|
| void |
onAttach(Context arg0)
|
| void |
onAttachFragment(Fragment arg0)
|
| void |
onConfigurationChanged(Configuration arg0)
|
| boolean |
onContextItemSelected(MenuItem arg0)
|
| void |
onCreate(Bundle arg0)
|
| Animation |
onCreateAnimation(int arg0, boolean arg1, int arg2)
|
| Animator |
onCreateAnimator(int arg0, boolean arg1, int arg2)
|
| void | |
| void | |
| View | |
| void |
onDestroy()
|
| void |
onDestroyOptionsMenu()
|
| void |
onDestroyView()
|
| void |
onDetach()
|
| LayoutInflater |
onGetLayoutInflater(Bundle arg0)
|
| void |
onHiddenChanged(boolean arg0)
|
| void | |
| void | |
| void |
onLowMemory()
|
| void |
onMultiWindowModeChanged(boolean arg0)
|
| boolean |
onOptionsItemSelected(MenuItem arg0)
|
| void |
onOptionsMenuClosed(Menu arg0)
|
| void |
onPause()
|
| void |
onPictureInPictureModeChanged(boolean arg0)
|
| void |
onPrepareOptionsMenu(Menu arg0)
|
| void |
onPrimaryNavigationFragmentChanged(boolean arg0)
|
| void |
onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2)
|
| void |
onResume()
|
| void |
onSaveInstanceState(Bundle arg0)
|
| void |
onStart()
|
| void |
onStop()
|
| void | |
| void |
onViewStateRestored(Bundle arg0)
|
| void |
postponeEnterTransition()
|
| final void |
postponeEnterTransition(long arg0, TimeUnit arg1)
|
| void |
registerForContextMenu(View arg0)
|
| final void |
requestPermissions(String[] arg0, int arg1)
|
| final FragmentActivity |
requireActivity()
|
| final Bundle |
requireArguments()
|
| final Context |
requireContext()
|
| final FragmentManager |
requireFragmentManager()
|
| final Object |
requireHost()
|
| final Fragment |
requireParentFragment()
|
| final View |
requireView()
|
| void |
setAllowEnterTransitionOverlap(boolean arg0)
|
| void |
setAllowReturnTransitionOverlap(boolean arg0)
|
| void |
setArguments(Bundle arg0)
|
| void |
setEnterSharedElementCallback(SharedElementCallback arg0)
|
| void |
setEnterTransition(Object arg0)
|
| void |
setExitSharedElementCallback(SharedElementCallback arg0)
|
| void |
setExitTransition(Object arg0)
|
| void |
setHasOptionsMenu(boolean arg0)
|
| void |
setInitialSavedState(Fragment.SavedState arg0)
|
| void |
setMenuVisibility(boolean arg0)
|
| void |
setReenterTransition(Object arg0)
|
| void |
setRetainInstance(boolean arg0)
|
| void |
setReturnTransition(Object arg0)
|
| void |
setSharedElementEnterTransition(Object arg0)
|
| void |
setSharedElementReturnTransition(Object arg0)
|
| void |
setTargetFragment(Fragment arg0, int arg1)
|
| void |
setUserVisibleHint(boolean arg0)
|
| boolean |
shouldShowRequestPermissionRationale(String arg0)
|
| void |
startActivity(Intent arg0)
|
| void | |
| void |
startActivityForResult(Intent arg0, int arg1)
|
| void | |
| void |
startIntentSenderForResult(IntentSender arg0, int arg1, Intent arg2, int arg3, int arg4, int arg5, Bundle arg6)
|
| void |
startPostponedEnterTransition()
|
| String |
toString()
|
| void |
unregisterForContextMenu(View arg0)
|
| abstract void |
onPeekTouch(HitTestResult hitTestResult, MotionEvent motionEvent)
Called when a touch event is dispatched to a scene.
|
| abstract void |
onConfigurationChanged(Configuration arg0)
|
| abstract void |
onLowMemory()
|
| abstract void |
| abstract Lifecycle |
getLifecycle()
|
| abstract ViewModelStore |
getViewModelStore()
|
| abstract ViewModelProvider.Factory |
getDefaultViewModelProviderFactory()
|
| abstract SavedStateRegistry |
getSavedStateRegistry()
|
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 Set<Session.Feature> getSessionFeatures ()
Specifies additional features for creating an ARCore Session. See
Session.Feature.
protected void handleSessionException (UnavailableException sessionException)
Parameters
| sessionException |
|---|