有没有办法知道给定的设备是否已做好AR准备?
我现在正在做这件事:
ArCoreApk.Availability availability = ArCoreApk.getInstance().checkAvailability(this);
if(availability.isSupported()){
Log.i("David", "Supported");
}else{
Log.i("David", "Not supported");
}这只检查ArcCore库是否安装在设备上,而不是检查设备是否在支持的设备的list中。我需要一个接一个地检查那份清单吗?
发布于 2020-01-22 22:03:03
@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。
https://stackoverflow.com/questions/59860606
复制相似问题