Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
ArCoreApk

Functions

 AR_DEFINE_ENUM (ArAvailability)
 
 AR_DEFINE_ENUM (ArInstallStatus)
 
 AR_DEFINE_ENUM (ArInstallBehavior)
 
 AR_DEFINE_ENUM (ArInstallUserMessageType)
 
void ArCoreApk_checkAvailability (void *env, void *application_context, ArAvailability *out_availability)
 
ArStatus ArCoreApk_requestInstall (void *env, void *application_activity, bool user_requested_install, ArInstallStatus *out_install_status)
 
ArStatus ArCoreApk_requestInstallCustom (void *env, void *application_activity, int32_t user_requested_install, ArInstallBehavior install_behavior, ArInstallUserMessageType message_type, ArInstallStatus *out_install_status)
 

Detailed Description

Management of the ARCore service APK

Function Documentation

◆ AR_DEFINE_ENUM() [1/4]

AR_DEFINE_ENUM ( ArAvailability  )

Describes the current state of ARCore availability on the device.

An internal error occurred while determining ARCore availability.

ARCore is not installed, and a query has been issued to check if ARCore is is supported.

ARCore is not installed, and the query to check if ARCore is supported timed out. This may be due to the device being offline.

ARCore is not supported on this device.

The device and Android version are supported, but the ARCore APK is not installed.

The device and Android version are supported, and a version of the ARCore APK is installed, but that ARCore APK version is too old.

ARCore is supported, installed, and available to use.

Definition at line 652 of file arcore_c_api.h.

652 {
653 /// An internal error occurred while determining ARCore availability.
654 AR_AVAILABILITY_UNKNOWN_ERROR = 0,
655 /// ARCore is not installed, and a query has been issued to check if ARCore
656 /// is is supported.
657 AR_AVAILABILITY_UNKNOWN_CHECKING = 1,
658 /// ARCore is not installed, and the query to check if ARCore is supported
659 /// timed out. This may be due to the device being offline.
660 AR_AVAILABILITY_UNKNOWN_TIMED_OUT = 2,
661 /// ARCore is not supported on this device.
662 AR_AVAILABILITY_UNSUPPORTED_DEVICE_NOT_CAPABLE = 100,
663 /// The device and Android version are supported, but the ARCore APK is not
664 /// installed.
665 AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED = 201,
666 /// The device and Android version are supported, and a version of the
667 /// ARCore APK is installed, but that ARCore APK version is too old.
668 AR_AVAILABILITY_SUPPORTED_APK_TOO_OLD = 202,
669 /// ARCore is supported, installed, and available to use.
670 AR_AVAILABILITY_SUPPORTED_INSTALLED = 203};

◆ AR_DEFINE_ENUM() [2/4]

AR_DEFINE_ENUM ( ArInstallBehavior  )

Controls the behavior of the installation UI.

Hide the Cancel button during initial prompt and prevent user from exiting via tap-outside.

Note: The BACK button or tapping outside of any marketplace-provided install dialog will still decline the installation.

Include Cancel button in initial prompt and allow easily backing out after installation has been initiated.

Definition at line 683 of file arcore_c_api.h.

683 {
684 /// Hide the Cancel button during initial prompt and prevent user from
685 /// exiting via tap-outside.
686 ///
687 /// Note: The BACK button or tapping outside of any marketplace-provided
688 /// install dialog will still decline the installation.
689 AR_INSTALL_BEHAVIOR_REQUIRED = 0,
690 /// Include Cancel button in initial prompt and allow easily backing out
691 /// after installation has been initiated.
692 AR_INSTALL_BEHAVIOR_OPTIONAL = 1};

◆ AR_DEFINE_ENUM() [3/4]

AR_DEFINE_ENUM ( ArInstallStatus  )

Indicates the outcome of a call to ArCoreApk_requestInstall().

The requested resource is already installed.

Installation of the resource was requested. The current activity will be paused.

Definition at line 674 of file arcore_c_api.h.

674 {
675 /// The requested resource is already installed.
676 AR_INSTALL_STATUS_INSTALLED = 0,
677 /// Installation of the resource was requested. The current activity will be
678 /// paused.
679 AR_INSTALL_STATUS_INSTALL_REQUESTED = 1};

◆ AR_DEFINE_ENUM() [4/4]

AR_DEFINE_ENUM ( ArInstallUserMessageType  )

Controls the message displayed by the installation UI.

Display a localized message like "This application requires ARCore...".

Display a localized message like "This feature requires ARCore...".

Application has explained why ARCore is required prior to calling ArCoreApk_requestInstall(), skip user education dialog.

Definition at line 696 of file arcore_c_api.h.

696 {
697 /// Display a localized message like "This application requires ARCore...".
698 AR_INSTALL_USER_MESSAGE_TYPE_APPLICATION = 0,
699 /// Display a localized message like "This feature requires ARCore...".
700 AR_INSTALL_USER_MESSAGE_TYPE_FEATURE = 1,
701 /// Application has explained why ARCore is required prior to calling
702 /// ArCoreApk_requestInstall(), skip user education dialog.
703 AR_INSTALL_USER_MESSAGE_TYPE_USER_ALREADY_INFORMED = 2};

◆ ArCoreApk_checkAvailability()

void ArCoreApk_checkAvailability ( void *  env,
void *  application_context,
ArAvailability *  out_availability 
)

Determines if ARCore is supported on this device. This may initiate a query with a remote service to determine if the device is compatible, in which case it will return immediately with out_availability set to #AR_AVAILABILITY_UNKNOWN_CHECKING.

For ARCore-required apps (as indicated by the manifest meta-data) this method will assume device compatibility and will always immediately return one of #AR_AVAILABILITY_SUPPORTED_INSTALLED, #AR_AVAILABILITY_SUPPORTED_APK_TOO_OLD, or #AR_AVAILABILITY_SUPPORTED_NOT_INSTALLED.

Note: A result #AR_AVAILABILITY_SUPPORTED_INSTALLED only indicates presence of a suitably versioned ARCore APK. Session creation may still fail if the ARCore APK has been sideloaded onto an incompatible device.

May be called prior to ArSession_create().

Parameters
[in]envThe application's JNIEnv object
[in]application_contextA jobject referencing the application's Android Context.
[out]out_availabilityA pointer to an ArAvailability to receive the result.

◆ ArCoreApk_requestInstall()

ArStatus ArCoreApk_requestInstall ( void *  env,
void *  application_activity,
bool  user_requested_install,
ArInstallStatus *  out_install_status 
)

Initiates installation of ARCore if needed. When your apllication launches or enters an AR mode, it should call this method with user_requested_install = 1.

If ARCore is installed and compatible, this function will set out_install_status to #AR_INSTALL_STATUS_INSTALLED.

If ARCore is not currently installed or the installed version not compatible, the function will set out_install_status to #AR_INSTALL_STATUS_INSTALL_REQUESTED and return immediately. Your current activity will then pause while the user is informed about the requierment of ARCore and offered the opportunity to install it.

When your activity resumes, you should call this method again, this time with user_requested_install = 0. This will either set out_install_status to #AR_INSTALL_STATUS_INSTALLED or return an error code indicating the reason that installation could not be completed.

ARCore-optional applications must ensure that ArCoreApk_checkAvailability() returns one of the AR_AVAILABILITY_SUPPORTED_... values before calling this method.

See our sample code for an example of how an ARCore-required application should use this function.

May be called prior to ArSession_create().

For more control over the message displayed and ease of exiting the process, see ArCoreApk_requestInstallCustom().

Caution: The value of *out_install_status should only be considered when #AR_SUCCESS is returned. Otherwise this value must be ignored.

Parameters
[in]envThe application's JNIEnv object
[in]application_activityA jobject referencing the application's current Android Activity.
[in]user_requested_installif set, override the previous installation failure message and always show the installation interface.
[out]out_install_statusA pointer to an ArInstallStatus to receive the resulting install status, if successful. Note: this value is only valid with the return value is #AR_SUCCESS.
Returns
#AR_SUCCESS, or any of:
  • #AR_ERROR_FATAL if an error occurs while checking for or requesting installation
  • #AR_UNAVAILABLE_DEVICE_NOT_COMPATIBLE if ARCore is not supported on this device.
  • #AR_UNAVAILABLE_USER_DECLINED_INSTALLATION if the user previously declined installation.

◆ ArCoreApk_requestInstallCustom()

ArStatus ArCoreApk_requestInstallCustom ( void *  env,
void *  application_activity,
int32_t  user_requested_install,
ArInstallBehavior  install_behavior,
ArInstallUserMessageType  message_type,
ArInstallStatus *  out_install_status 
)

Initiates installation of ARCore if required, with configurable behavior.

This is a more flexible version of ArCoreApk_requestInstall() allowing the application control over the initial informational dialog and ease of exiting or cancelling the installation.

See ArCoreApk_requestInstall() for details of use and behavior.

May be called prior to ArSession_create().

Parameters
[in]envThe application's JNIEnv object
[in]application_activityA jobject referencing the application's current Android Activity.
[in]user_requested_installif set, override the previous installation failure message and always show the installation interface.
[in]install_behaviorcontrols the presence of the cancel button at the user education screen and if tapping outside the education screen or install-in-progress screen causes them to dismiss.
[in]message_typecontrols the text of the of message displayed before showing the install prompt, or disables display of this message.
[out]out_install_statusA pointer to an ArInstallStatus to receive the resulting install status, if successful. Note: this value is only valid with the return value is #AR_SUCCESS.
Returns
#AR_SUCCESS, or any of:
  • #AR_ERROR_FATAL if an error occurs while checking for or requesting installation
  • #AR_UNAVAILABLE_DEVICE_NOT_COMPATIBLE if ARCore is not supported on this device.
  • #AR_UNAVAILABLE_USER_DECLINED_INSTALLATION if the user previously declined installation.