Search Unity

ARcore not working on Samsang S9

Discussion in 'Vuforia' started by monark, Nov 8, 2018.

  1. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    So I've followed these steps for installing ARcore into Unity
    https://library.vuforia.com/content/vuforia-library/en/articles/Solution/arcore-with-vuforia.html

    But when I run it on a Samsung S9 and use this to test for it

    Code (CSharp):
    1. FusionProviderType trackerType = VuforiaRuntimeUtilities.GetActiveFusionProvider();
    2. if (trackerType == FusionProviderType.PLATFORM_SENSOR_FUSION) return true;
    3. else return false;
    It always returns false.

    According to this information
    https://library.vuforia.com/articles/Solution/vuforia-fusion-supported-devices.html

    Samsung S9 SM-G960F should work.

    What else do I need to do?

    Unity version 2018.2.10f1
    Vuforia 7.5.26
    Android version 8.0.0
    ARcore version 1.5.0
    Latest Android SDK
    JDK jdk1.8.0_191.jdk
    NDK android-ndk-r13b
     
    Last edited: Nov 8, 2018
  2. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello,

    Are you making the call after Vuforia has been initialized?

    GetActiveFusionProvider() must be called after initializing Vuforia. If called before, it will return INVALID_OPERATION.

    Thanks,
    Vuforia Engine Support
     
  3. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
  4. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
  5. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    I've now built a test app that has nothing but a simple AR scene and a button that returns the response from GetActiveFusionProvider()
    Even though I can see a ground plane, so Vuforia is definitely up and running, if you tap the button the response is PLATFORM_SENSOR_FUSION false.
     
  6. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello,

    I did some testing today by modifying our Core Samples to add some additional logging. I updated GroundPlaneUI.cs as follows:

    Code (CSharp):
    1.     #region VUFORIA_CALLBACKS
    2.     void OnDevicePoseStatusChanged(Vuforia.TrackableBehaviour.Status status, Vuforia.TrackableBehaviour.StatusInfo statusInfo)
    3.     {
    4.         Debug.Log("OnDevicePoseStatusChanged(" + status + ", " + statusInfo + ")");
    5.  
    6.         switch (statusInfo)
    7.         {
    8.             case Vuforia.TrackableBehaviour.StatusInfo.INITIALIZING:
    9.  
    10.                 if (Vuforia.VuforiaRuntimeUtilities.GetActiveFusionProvider() ==
    11.                     Vuforia.FusionProviderType.PLATFORM_SENSOR_FUSION)
    12.                 {
    13.                     m_TrackerStatus.text = "Initializing Tracker";
    14.                     Debug.Log("GetActiveFusionProvider() == FusionProviderType.PLATFORM_SENSOR_FUSION");
    15.  
    16.                 }
    17.                 else
    18.                 {
    19.                     m_TrackerStatus.text = "Waiting for anchor to be placed to initialize";
    20.                     Debug.Log("GetActiveFusionProvider() != FusionProviderType.PLATFORM_SENSOR_FUSION");
    21.  
    22.                 }
    23.              
    24.                 break;
    25.             case Vuforia.TrackableBehaviour.StatusInfo.UNKNOWN:
    26.  
    27.                 if (Vuforia.VuforiaRuntimeUtilities.GetActiveFusionProvider() ==
    28.                     Vuforia.FusionProviderType.PLATFORM_SENSOR_FUSION)
    29.                 {
    30.                     m_TrackerStatus.text = "Initializing Tracker";
    31.                     Debug.Log("GetActiveFusionProvider() == FusionProviderType.PLATFORM_SENSOR_FUSION");
    32.  
    33.                 }
    34.                 else
    35.                 {
    36.                     m_TrackerStatus.text = "Waiting for anchor to be placed to initialize";
    37.                     Debug.Log("GetActiveFusionProvider() != FusionProviderType.PLATFORM_SENSOR_FUSION");
    38.  
    39.                 }
    40.              
    41.                 break;
    42.             case Vuforia.TrackableBehaviour.StatusInfo.NORMAL:
    43.  
    44.                 if (Vuforia.VuforiaRuntimeUtilities.GetActiveFusionProvider() ==
    45.                     Vuforia.FusionProviderType.PLATFORM_SENSOR_FUSION)
    46.                 {
    47.                     m_TrackerStatus.text = "Tracking";
    48.                     Debug.Log("GetActiveFusionProvider() == FusionProviderType.PLATFORM_SENSOR_FUSION");
    49.  
    50.                 }
    51.              
    52.                 break;
    53.  
    When running this on a similar Android device, I see the following messages on ADB:

    11-14 11:00:40.881 11928 11944 I Unity : OnDevicePoseStatusChanged(DEGRADED, UNKNOWN)
    11-14 11:00:40.885 11928 11944 I Unity : GetActiveFusionProvider() == FusionProviderType.PLATFORM_SENSOR_FUSION
    11-14 11:00:41.333 11928 11944 I Unity : OnDevicePoseStatusChanged(TRACKED, NORMAL)
    11-14 11:00:41.333 11928 11944 I Unity : GetActiveFusionProvider() == FusionProviderType.PLATFORM_SENSOR_FUSION

    This indicates to me that Vuforia is accurately detecting support for ARCore, and is returning the appropriate values on test of FusionProviderType.PLATFORM_SENSOR_FUSION.

    Here is a table that maps the return values of TrackableBehaviour.Status and TrackableBehaviour.StatusInfo:

    https://library.vuforia.com/content/vuforia-library/en/articles/Solution/tracking-state.html

    My understanding is that we are revisiting these return values in an upcoming release to make them more homogeneous between provider platforms (ARKit, ARCore, Vuforia VIO) and useful for developers.

    Thanks,
    Vuforia Engine Support
     
  7. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Well I sent off a test project to Unity as I couldn't see a way to do that on your own support site, I'm hoping you guys talk to each other.
    It does nothing other than add a ground plane and AR camera and then has a UI button to return the status of GetActiveFusionProvider() when you tap it. On my S9 that consistently returns false for FusionProviderType.PLATFORM_SENSOR_FUSION

    I don't know if there is something else I'm missing in the setup to get this working but that project shows what I'm actually doing.

    My assumption according to your help pages is that I don't need to do anything with the manifest as it doesn't say to do anything for Unity other than add the core plugin.

    Maybe something else needs to be done to get Vuforia to recognise ARcore support?
     
  8. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello @monark,

    Using the Unity Vuforia Core Samples, I was able to create an APK that ran on a Galaxy S8 and detect ARCore. I decrypted that APK with apktool and found the following line in the manifest file:

    <meta-data android:name="com.google.ar.core" android:value="optional"/>

    This is the same as what has been spelled out in the native Android requirements:

    https://library.vuforia.com/content/vuforia-library/en/articles/Solution/arcore-with-vuforia.html

    Thus, for me, the recommended Unity workflow in the article behaves as expected. I'm at a loss for why you're experiencing something different.

    Thanks,
    Vuforia Engine Support
     
  9. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Ah ok maybe there's the issue then.
    When I build an app from scratch this is the manifest I get.

    That line you have doesn't appear. Could that be it?
    Are we meant to add that manually, does your help need updating?

    This only talks about adding that line for native apps
    https://library.vuforia.com/content/vuforia-library/en/articles/Solution/arcore-with-vuforia.html
     
    Last edited: Nov 19, 2018
  10. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Adding that line in manually doesn't appear to solve the issue either.
    I can see it in the built manifest but I still don't get FusionProviderType.PLATFORM_SENSOR_FUSION returning true.
     
  11. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Is there a problem with this line extracted from the manifest?

    <meta-data android:name="com.google.ar.core.min_apk_version" android:value="180815000" />

    Should that value not be android:value="19" ?

    [edit] I think that value is actually correct. So it's something else.
     
    Last edited: Nov 19, 2018
  12. lrb

    lrb

    Joined:
    Jun 21, 2014
    Posts:
    18
    Hey @monark , have you installed the "ARCore by Google" from Google Play?
    Vuforia will only use it if it was previously installed.
     
    meedabit likes this.
  13. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Ah! that's it.
    Why on earth doesn't it say to do that in the help???

    Thank you, thank you, thank you.
     
  14. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    So how do you handle that with actual app users?
    I had assumed including it in the plugin directory was enough.
    Do you detect if it's missing and request users manually install it?
    Can you make it a requirement of the app so they are prompted to install it?

    Seems like a bit of a missing link, how would they know. I had no clue you needed to install it independently I assumed it was like iOS and installed with the Android OS.
     
  15. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello @monark,

    Google's decision to package ARCore separately (instead of including it as part of Android OS) has made challenging for Vuforia to properly package support in our samples.Thus, rather than create an ARCore dependency upon our samples (where ARCore can be updated at any time without warning for Vuforia), we took the decision to *not* package it with our samples. The AAR file, as mentioned in documentation, is used to allow the app to connect to the ARCore service on the device (if available), and it contains the functionality to download it - after user consent - to install the service at runtime of the app, if the device is supported.

    Apologies for the challenges you faced in getting this issue resolved. The fact that you list the ARCore version in your original post misled me to think it was already installed on the device. Thanks to @lrb for the practical suggestion.

    I'll review our documentation again to see if there are improvements to emphasize that ARCore must be installed on the device.

    Thanks,
    Vuforia Engine Support
     
  16. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    I've now included a message to the user to manually install it if the app fails to detect it.
    I'm guessing that's best practice in this instance.
    But yes it would be good to detail this in the Unity getting started guide.
     
  17. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    So I've upgraded my project to Unity 2018.2.12 and Vuforia 8.0 and even with AR core installed this has gone back to returning false again. Is there now some new trick to get it to work?
     
    Last edited: Aug 8, 2019
  18. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello @monark,

    There have been no recent changes to Vuforia Fusion, and we are not aware of any bugs with our integration with ARCore.

    We can investigate further with more information:
    • Device model: Settings->About phone/device->Model number
    • Device OS version
    • ARCore version
    If possible, please be specific about which API call is returning an unexpected "false" value.

    Thanks,
    Vuforia Engine Support
     
  19. Cec

    Cec

    Joined:
    Apr 7, 2014
    Posts:
    46
    I've got same issue with my project.
     
  20. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    I'm trying to put put together a simple test case, but I this is the bit of code that appears to not be working any more for me

    Code (CSharp):
    1. bool IsSupportedArCore()
    2.     {
    3.         #if UNITY_EDITOR
    4.         return true;
    5.         #endif
    6.  
    7.         //is this active at this point?
    8.         FusionProviderType trackerType = VuforiaRuntimeUtilities.GetActiveFusionProvider();
    9.  
    10.         if (trackerType == FusionProviderType.INVALID_OPERATION )
    11.             return false;
    12.         else if (trackerType == FusionProviderType.PLATFORM_SENSOR_FUSION)
    13.             return true;
    14.         else
    15.             return false;
    16.     }
    Device's are
    Samsung S9 - Android 9
    Huawei P20 - Android 8.1.0

    A simple test scene has been reported to Unity as (Case 1175240) I don't know if you have access to that?
    But basically it's literally a button that calls the above function and displays the result.

    Unity 2018.2.12
    Vuforia 8.0
    ARcore 1.5.0
     
    Last edited: Aug 8, 2019
  21. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    So some more information on this in U2018.4.5 with Vuforia 8.3.8 in the Vuforia configuration if I set ARcore requirement = REQUIRED or OPTIONAL and build with Gradle I can get that function to work in a simple test app.

    Unfortunately my actual project is in U2018.2.12 with 8.0 and that option in Vuforia config isn't available.

    Upgrading to 2018.4.5 causes a whole heap of other issues in my real project and doesn't seem to fix the problem either.... total nightmare.
    U2018.4.5 - Gradle won't build, gestures fail and Vuforia doesn't detect AR core.
     
    Last edited: Aug 8, 2019
  22. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Ok I've figured it out.
    Basically Vuforia doesn't work in 2018.2.12 with ARM64 as the build target.
    If I build to ARMv7 only then it works.
    This is an issue though as Google Play are now requiring that new builds have ARM64 support
     
    meedabit likes this.
  23. meedabit

    meedabit

    Official Vuforia Employee Vuforia

    Joined:
    Dec 8, 2016
    Posts:
    253
    Hello @monark,

    Support for Android 64-bit builds was added in 8.1.7.

    What is not clear to me is the relationship between the Engine installation components, and what the Unity Editor requires to create different build types. I know that some devs have had success installing newer versions of Vuforia Engine with older (and unsupported) versions of the Unity Editor, but I am not clear if the combinations you're using will work as they have not been tested by our team.

    Thanks,
    Vuforia Engine Support
     
  24. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    There appears to be no option in 2018.2 to install any version of Vuforia beyond 8.0
    Unity don't support anything below 2018.4 now so my only option is to upgrade to a build where Vuforia works and then fix all the issues that creates with everything else...
     
  25. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    ...and having done all that, it still fails. :(

    I can get my simple test case to work.
    But for my actual project it can't detect AR core even for ARMv7 now.

    Unity 2018.4.6
    Build system Internal (Still can't get Gradle building to work)
    Vuforia 8.3.8
    Phone S9
    Android v9

    The only difference is that in my simple case Vuforia is used in the first scene.
    In my real project I don't load the Vuforia scene till later in the process. However this used to work fine right up til 2018.2
     
    Last edited: Aug 12, 2019
  26. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    I finally had success with this combination

    Unity 2018.4.6
    Vuforia 8.3.8
    Core-1.11.0
    NDK 16b
    Internal build system
    Manually add <meta-data android:name="com.google.ar.core" android:value="optional" /> to the manifest
     
    Last edited: Aug 13, 2019
  27. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Unfortunately although this does "work" it's also adding the dreaded READ_PHONE_STATE to the manifest which is next to impossible to remove. So the saga continues...
     
  28. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Ok so I may have a new combination that works...
    Unity 2018.3.14f2
    Vuforia 8.1.7 (which comes as the default for that build)
    Core-1.11.0
    NDK 16b
    Internal build system

    No need to modify the manifest and it doesn't add READ_PHONE_STATE
    Also the video pass through works.

    What it doesn't do is request permission for access to external storage, which I happen to need for saving images, but I believe there is a fix for that...
     
    Last edited: Aug 14, 2019