繁体   English   中英

了解给定设备是否在 AR 支持设备列表中

[英]Know if a given device is in the list of supported devices for AR

有什么方法可以知道给定设备是否已准备好 AR?

我现在正在这样做:

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

AFAIK,这只会检查设备中是否安装了 ArcCore lib,而不检查设备是否在支持的设备列表中。 我必须一张一张地检查那个清单吗?

@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);
  }
}

通过此您可以检查设备是否支持 ARCore。 如果未安装 ARCore,则您可以使用 ArCoreApk.requestInstall() 检查,ArCore 仅在受支持的设备上无法安装。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM