Search Unity

Question [SOLVED] Publish AAB file to Playstore for ARFoundation project withouth the Oculus permissions

Discussion in 'AR' started by Yann_de_Couessin, May 31, 2023.

  1. Yann_de_Couessin

    Yann_de_Couessin

    Joined:
    Jan 2, 2015
    Posts:
    40
    Hey everybody !

    I encountered a permission issue when submitting my project that uses OpenXR, Meta and ARFoundation libraries. I think Meta's libraries messes up when building my apk / aab since when I try to remove the android manifest (from plugins, temp, staging folders... whatever) it stills add a bunch of VR related permissions and autorisations.

    upload_2023-5-31_17-53-36.png

    upload_2023-5-31_17-53-49.png

    upload_2023-5-31_17-54-13.png

    upload_2023-5-31_17-54-18.png
    Is there a way to over-override it ?

    Regards !
     
  2. unity_andrewc

    unity_andrewc

    Unity Technologies

    Joined:
    Dec 14, 2015
    Posts:
    223
    Can you try removing the reference to the com.unity.xr.oculus package from your project manifest? (Or removing it through the Package Manager window.)
     
  3. Yann_de_Couessin

    Yann_de_Couessin

    Joined:
    Jan 2, 2015
    Posts:
    40
    Hi @unity_andrewc and thanks for your fast answer.

    Since I wanted to develop the same experience both in VR and AR without changing anything in my unity project, I was afraid to loose some Meta feature but you're right, removing com.unity.xr.oculus keeps OpenXR meta's feature and also the passthrough scripts, since I use the Oculus integration package.

    But when recompiling for Play store without this com.unity.xr.oculus package and trying a new build submission, it still shows the Meta stuff :

    upload_2023-6-2_10-11-57.png

    If I remove Oculus integration (the whole Oculus folder), it forces me to maintain two separated Unity projects so maybe I'm missing something ?

    Edit : so far the only workaround seems to be this:

    This one is a pain, but here it goes. Basically code inside Unity is adding those permissions after the build. So even if you remove the permissions on the manifest it would not work. What you need is to download apktool and decompress your program's apk, then remove the lines from the manifest. Use Apk tool to compress the folder and make another apk, this other apk needs to be aligned with zipalign, and then signed with apksigner. After that upload the app. I got it working with Oculus Integration 50 and Unity 2022.2.16f1
    from Meta's forums

    Edit 2 : I remembered a tools:node="remove" tip I used a while, and it works fine !
    Here's my manifest override :

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.unity3d.player"
    5.     xmlns:tools="http://schemas.android.com/tools">
    6.     <application>
    7.         <activity android:name="com.unity3d.player.UnityPlayerActivity"
    8.                   android:theme="@style/UnityThemeSelector">
    9.             <intent-filter>
    10.                 <action android:name="android.intent.action.MAIN" />
    11.                 <category android:name="android.intent.category.LAUNCHER" />
    12.             </intent-filter>
    13.         </activity>
    14.             <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    15.            
    16.             <!-- "AR Required" app, requires "Google Play Services for AR" (ARCore)
    17.             to be installed, as the app does not include any non-AR features. -->
    18.             <meta-data android:name="com.google.ar.core" android:value="required" />
    19.  
    20.     </application>
    21.    
    22.     <!-- Remove Oculus stuff while building-->
    23.     <uses-permission android:name="com.oculus.permission.HAND_TRACKING" tools:node="remove" />
    24.     <uses-permission android:name="com.oculus.permission.RENDER_MODEL" tools:node="remove" />
    25.     <uses-feature android:name="android.hardware.vr.headtracking" android:required="true" tools:node="remove"/>
    26.     <uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" tools:node="remove"/>
    27.     <uses-feature android:name="com.oculus.feature.RENDER_MODEL" android:required="true" tools:node="remove"/>
    28.     <uses-feature android:name="oculus.software.handtracking" android:required="true" tools:node="remove"/>
    29.    
    30.     <uses-permission android:name="android.permission.CAMERA" />
    31.     <!-- Limits app visibility in the Google Play Store to ARCore supported devices
    32.     (https://developers.google.com/ar/devices). -->
    33.  
    34.     <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    35.  
    36. </manifest>
    37.  

    Thanks for your time
    Regards !
     

    Attached Files:

    Last edited: Jun 2, 2023
    andyb-unity and unity_andrewc like this.