To create compelling AR user experiences, it's important that your AR-enabled app performs well.
Ensure that your app:
- Feels responsive to user input, which includes touch gestures and device motion.
- Renders at a reasonable and consistent frame rate. Users generally prefer frame rates that are consistent and lower over frame rates that are variable and higher.
- Minimizes battery drain, enabling your user to use their device for other tasks throughout the day, or engage longer with your AR experience.
- Constructs a compelling AR experience where AR-generated content appears stable relative to the environment, and realistically blends in with the environment.
Performance best practices
To create more compelling AR experiences, design with the following best practices in mind.
Use anchors to improve tracking performance
Although it's possible to place your 3D content using world-space coordinates, always use an anchor whenever possible. ARCore ensures that anchors appear stable relative to the world, even though the underlying world-space coordinates change and may jump over time whenever ARCore updates its understanding of the world.
Virtual objects that aren't attached to an anchor will occasionally appear to jump and will not appear stable relative to the environment. This can make the AR experience less compelling for users.
Consider device-specific performance characteristics
ARCore supported devices cover a wide range of hardware and performance characteristics. Device performance can vary due to:
- Device CPU/GPU, clock speed
- Available memory and bandwidth
- Camera/IMU sensor quality
- Other hardware differences
- Operating system and devices drivers
We recommend testing your app on different classes of devices that are representative of the devices your users will use.
Disable CPU intensive features when not in use
Certain ARCore features increase CPU utilization while enabled. Consider disabling these features during times when your AR experience doesn't require them. This will make additional CPU cycles available to your app, and improve thermal performance and battery life.
Currently, ARCore CPU utilization increases when Instant Placement and/or Augmented Images is enabled for the current session. Follow these guidelines to increase CPU utilization efficiency:
Instant Placement should be disabled once full tracking has been established. The feature can be disabled in the session config.
Augmented Images should be disabled whenever the feature is not required for your AR experience. To disable Augmented Images, configure a
null
or empty Augmented Images database in the session config.
Monitor device thermals
During development and QA testing, you can use Android's thermal APIs to monitor and track performance of your app on device.
Make sure to use a production build of your app (and not a development or qa build of your app that might have different runtime performance characteristics.
PowerManager#getCurrentThermalStatus()
(API level 29)PowerManager#getThermalHeadroom(int)
(API level 30)
Identify ARCore CPU starvation
When an ARCore session is active, your app must share limited mobile CPU and GPU resources with ARCore. CPU bound apps can compete with the CPU resources required for motion tracking.
To verify that ARCore's simultaneous localization and mapping (SLAM) is able to run normally, verify that the "VIO frequency low" message does not appear in the Android device logs:
adb logcat | grep 'VIO frequency low'
Avoid ARCore CPU starvation
When an ARCore session is active, your app must share limited mobile CPU and GPU resources device with ARCore. CPU bound apps can compete with the CPU resources required for motion tracking.
Pre-create the Augmented Images databases
When possible, pre-create your Augmented Image databases at development time. If it's necessary to create Augmented Image databases at runtime or dynamically add images to an existing database, make sure to add images in a background thread to avoid blocking the main UI thread.
Limit the number of requested camera streams
When using Java Shared Camera, apps can request additional CPU or GPU image streams.