Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

ARCore install should be prompted if necessary on Android devices #171

Closed leoncvlt closed 5 years ago

leoncvlt commented 5 years ago

I have noticed that when starting a ARFoundation project on a ARCore-compatible devices but WITHOUT ARCore installed from the Play Store, you don't get any kind of prompt for the missing functionality - just a black screen, no camera permissions, any non-AR objects like screen canvases working fine. It works fine once installing ARCore from the Play Store, but I've banged my head on this a few times already at work, where I'd grab another development device without ARCore and thinking I broke something in the Unity project.

Should a prompt asking to download ARCore appear in this cases? Does Google offer any native solution for this?

tdmowrer commented 5 years ago

Such a prompt does exist in the ARCore XR Plugin. However, if your app is marked as "ARCore Required", then the assumption is that you couldn't have installed it without ARCore in the first place (the Play store would not let this happen).

This means that if you side load the APK (e.g., Build & Run from Unity) and your app is "ARCore Required" and ARCore is not already installed, then it does not work and there is no prompt. This is the intended behavior from Google's ARCore SDK.

dorkbot commented 5 years ago

I have been experiencing some strange things with ARCore updates and my app in the Google Play store. When I first downloaded my app, the AR scene wouldn't load, it would just show a black screen. ARCore was up to date and I had deleted all previous version of my app that were side loaded before installing the app from the store. After I experienced the black screen, I uninstalled ARCore via the Google Play store, then tried the app to see if I would get an ARCore prompt, I did not, but the app worked, the AR scene loaded! I then checked ARCore and found that it was now installed, so it was installed without my permission? And why didn't my app work when ARCore was already up to date? Any ideas or advise? Is this just an edge case that was caused by me side loading the app in the past and shouldn't worry that other users will experience the same?

nilsk123 commented 5 years ago

Such a prompt does exist in the ARCore XR Plugin. However, if your app is marked as "ARCore Required", then the assumption is that you couldn't have installed it without ARCore in the first place (the Play store would not let this happen).

This means that if you side load the APK (e.g., Build & Run from Unity) and your app is "ARCore Required" and ARCore is not already installed, then it does not work and there is no prompt. This is the intended behavior from Google's ARCore SDK.

What if a user deletes arcore after installing the app?

tdmowrer commented 5 years ago

I'm slightly wrong about that. To amend my original statement:

This means that if you side load the APK (e.g., Build & Run from Unity) and your app is "ARCore Required" and ARCore is not ~already installed~ supported, then it does not work and there is no prompt. This is the intended behavior from Google's ARCore SDK.

If the device is supported but ARCore is not installed (e.g., because the user deletes ARCore after installing the app), then there is a prompt to reinstall it. I've just tested this to confirm that behavior.

Here's the full explanation from Google: https://developers.google.com/ar/develop/java/enable-arcore

ARFoundation takes care of the "runtime checks" for you.

flankechen commented 2 years ago

I notice something that might lead undesired behaviour with arfoundation.

  1. "arcore require"

    yield return ARSession.CheckAvailability();
            Debug.Log("install arcore state "+ARSession.state);

    would return "NeedsInstall" ARSession.state, then I can call ARSession.Install() to promote a installation by google play store, if I delete "arcore" manually.

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                yield return ARSession.Install();
            }
  2. "arcore optional"

    yield return ARSession.CheckAvailability();
            Debug.Log("install arcore state "+ARSession.state);

    would return "Unsupported" state for same device. I think this is wrong, device could actually install and run arcore should not return unsupported state with just arcore require/optional change.

Device: Xiaomi K40 Xiaomi M2012K11AC ARFoundation: "com.unity.xr.arfoundation": "4.1.1",