1

Is there any way to know if a given device is AR ready?

I am doing this right now:

ArCoreApk.Availability availability = ArCoreApk.getInstance().checkAvailability(this);
            if(availability.isSupported()){
                Log.i("David", "Supported");
            }else{
                Log.i("David", "Not supported");
            }

AFAIK, this only checks if ArcCore lib is installed in a device, not if a device is in the list of supported devices. Do I have to check that list one by one?

Fustigador
  • 6,339
  • 12
  • 59
  • 115

1 Answers1

0
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  maybeEnableArButton();
}

void maybeEnableArButton() {
  ArCoreApk.Availability availability = ArCoreApk.getInstance().checkAvailability(this);
  if (availability.isTransient()) {
    new Handler().postDelayed(new Runnable() {
      @Override
      public void run() {
        maybeEnableArButton();
      }
    }, 200);
  }
  if (availability.isSupported()) {
    mArButton.setVisibility(View.VISIBLE);
    mArButton.setEnabled(true);
    // indicator on the button.
  } else { // Unsupported or unknown.
    mArButton.setVisibility(View.INVISIBLE);
    mArButton.setEnabled(false);
  }
}

By this you can check whether the ARCore is supported on the device. If the ARCore is not installed then you can check with ArCoreApk.requestInstall() and ArCore installation will be unable on supported devices only.

  • I still have the problem as this method says that my device can support ar services, but google play says that ar services can't be installed. Maybe you know how that can happen? – CottaLotties May 04 '22 at 11:13
  • @prashant varma I tried your solution provided on Google ARCOre docs. But problem with this solution is that `availability.isSupported()` is always return `true` and thats why else part is not getting executed. So no non-supported devices button is not disabled. –  rocco Jan 16 '23 at 05:32
  • @Fustigador I found solution for this. Check [here](https://stackoverflow.com/questions/75130627/how-to-know-if-a-given-device-is-in-the-list-of-supported-devices-for-ar). –  rocco Jan 18 '23 at 06:29