Sorry to keep opening issues! This is just a question, though.
What's the best way to ask the SDK if the current device + OS version is supported? I see there's ways to figure out if the device is unsupported when attempting to create an AR session, but we want to implement some UI flows that prevent the user from entering AR if their device isn't supported in the first place. This is made trickier by the fact that creating that doomed-to-fail session requires min SDK version 24, but we want to know on any device.
We are already planning to submit multiple APKs with different minimum SDK versions, so we might hardcode some kind of solution. We are already looking into maintaining a device whitelist. However, this really seems like something ARCore would ideally provide for us. Any suggestions?
There is no way to currently do this. We are adding API surface for this in an upcoming release. Stay tuned!
Or you can use Vuforia. They say they use ARcore whenever possible, and when it's not, they do their own (probably not as good) plane detection solution.
Any news on the whitelist since the ARCore was released?
I dont think you need it.
On your manifest there will be an ARcore required statement.
I believe that would cause it to not showup in google play for un supported devices.
And even if you omit this statement, there's an api for checking if ARcore service is installed
That's all true, but the AR thing is just an option in our app.
We want the app to be available for all phones and the AR option to show up only on whitelisted devices.
So use Session.CheckApkAvailability()
And see if it returns ApkAvailabilityStatus.UnsupportedDeviceNotCapable
Yup, what @alons1 said is exactly correct with 1.0.
I'm closing this issue as it is now resolved.
Are there any examples of this actually working? I'm making the call, but my "ThenAction" never gets invoked. I've tried this with a coroutine as well to no avail.
I've added debug logs throughout LifecycleManager. OnCheckApkAvailabilityResultTrampoline is never called.
Ryan, could you provide a sample project that reproduces this issue? That'll help us track this down.
Anyone managed to solve this problem? Im having the same issue, CheckAPKAvaiability works on a S7 but doesnt work on a android 6 device.
Hi @paulodgn,
It doesn't even need to be checked on android 6 device because this version is not supported by AR.
In Unity2017.3.1p2 you can build app with minimum SDK lower than 24 and have AR enabled.
Then we're checking if the device's android SDK is >= 24 before checking the apk availability.
Hi, this issue has been fixed in ARCore Unity SDK v1.2.0. Feel free to reopen if you still experience the issue.
Are you sure the issue has been fixed? I'm using Unity 2018.1.0f2 and ArCore 1.2.0 and CheckAPKAvaiability works on a S7 but doesn't work on Huawei P9 lite (Android 7), Galaxy J5 (Android 5.1), Galaxy S3 (Android 4.3).
This is the code I'm using:
using System.Collections;
using UnityEngine;
using GoogleARCore;
using UnityEngine.UI;
public class ARoptional : MonoBehaviour {
// Use this for initialization
void Start () {
string name = SystemInfo.operatingSystem.ToString();
int foundS1 = name.IndexOf("-");
name = name.Substring(foundS1 + 1, 2);
int api = int.Parse(name);
Debug.Log("Device with API: " + api);
if (api < 24)
{
Debug.Log("Unsupported device");
} else
{
StartCoroutine(CheckCompatibility());
}
}
private void _ShowAndroidToastMessage(string message)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject unityActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
if (unityActivity != null)
{
AndroidJavaClass toastClass = new AndroidJavaClass("android.widget.Toast");
unityActivity.Call("runOnUiThread", new AndroidJavaRunnable(() =>
{
AndroidJavaObject toastObject = toastClass.CallStatic<AndroidJavaObject>("makeText", unityActivity,
message, 0);
toastObject.Call("show");
}));
}
}
private IEnumerator CheckCompatibility()
{
AsyncTask<ApkAvailabilityStatus> checkTask = Session.CheckApkAvailability();
CustomYieldInstruction customYield = checkTask.WaitForCompletion();
yield return customYield;
ApkAvailabilityStatus result = checkTask.Result;
switch (result)
{
case ApkAvailabilityStatus.SupportedApkTooOld:
_ShowAndroidToastMessage("Supported apk too old");
Session.RequestApkInstallation(false);
break;
case ApkAvailabilityStatus.SupportedInstalled:
_ShowAndroidToastMessage("Supported and installed");
break;
case ApkAvailabilityStatus.SupportedNotInstalled:
_ShowAndroidToastMessage("Supported, not installed, requesting installation");
Session.RequestApkInstallation(false);
break;
case ApkAvailabilityStatus.UnknownChecking:
_ShowAndroidToastMessage("Unknown Checking");
break;
case ApkAvailabilityStatus.UnknownError:
_ShowAndroidToastMessage("Unknown Error");
break;
case ApkAvailabilityStatus.UnknownTimedOut:
_ShowAndroidToastMessage("Unknown Timed out");
break;
case ApkAvailabilityStatus.UnsupportedDeviceNotCapable:
_ShowAndroidToastMessage("Unsupported Device Not Capable");
Debug.Log("Unsupported device");
break;
}
}
}
Most helpful comment
Hi @paulodgn,
It doesn't even need to be checked on android 6 device because this version is not supported by AR.
In Unity2017.3.1p2 you can build app with minimum SDK lower than 24 and have AR enabled.
Then we're checking if the device's android SDK is >= 24 before checking the apk availability.