ARCore call logging

When troubleshooting runtime behavior and performance issues in your Android app, you can log ARCore API calls to the Android device log.

When you enable call logging, ARCore will log all API calls with their C API name, regardless of the SDK that the app was built with. All C API names can be found in the C API reference documentation, along with their parameters and return values.

Enable API call logging

ARCore API calls that do not take ArSession* parameters such as *_destroy and *_release functions are not logged.

Follow these steps to enable ARCore API call logging.

  1. Ensure that Google Play Services for AR (ARCore) 1.23 or later is installed:

    • On Windows, run adb shell pm dump com.google.ar.core | findstr /i "packages: versionName".
    • On macOS, run adb shell pm dump com.google.ar.core | egrep -i versionName\|packages:.
  2. Open the AR experience in your app so that there is an active ARCore session running. Your app must be in AR mode to receive the broadcast that enables logging. The AR camera preview images should be visible on the device screen.

  3. Use the following activity manager broadcast command to enable call logging: for your app.

    # Enables ARCore call logging and saves a setting to your app's
    # Android Shared Preferences, so that call logging remains enabled in
    # subsequent ARCore sessions.
    
    # Your app must have an actively running ARCore session to receive the broadcast.
    adb shell am broadcast -a com.google.ar.core.ENABLE_API_CALL_LOGGING

Disable API call logging

Follow these steps to disable ARCore API call logging.

  1. Open the AR experience in your app so that there is an active ARCore session running. Your app must be in AR mode to receive the broadcast that disables logging. The AR camera preview images should be visible on the device screen.

  2. Use the following activity manager broadcast command to disable call logging for your app:

    # Disables ARCore call logging and saves a setting to your app's
    # Android Shared Preferences, so that call logging remains disabled in
    # subsequent ARCore sessions.
    
    # Your app must have an actively running ARCore session to receive the broadcast.
    adb shell am broadcast -a com.google.ar.core.DISABLE_API_CALL_LOGGING

Viewing the output

ARCore uses the ARCore-Api tag for all ARCore API logging output. Use the following command to filter only those calls.

# Currently, ARCore only logs API calls that take an `ArSession*` argument.
# Functions that do not take session parameters such as `*_destroy` and `*_release` are not logged.
# -s is equivalent to the filter expression '*:S', which sets priority for all tags to silent.

adb logcat -s ARCore-Api

ARCore rate-limits the output to reduce log spam. It aggregates skipped log messages into a single log message.

Example output of skipped log messages:

D ARCore-Api: ArFrame_create(<ptr>)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195)
D ARCore-Api: ArFrame_create(<ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS (suppressing for 10s)
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195) (suppressing for 10s)