Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

App built with VR disabled still asks to be placed in Gear VR on a Samsung

Discussion in 'AR/VR (XR) Discussion' started by amplifiedciaran, Sep 4, 2017.

  1. amplifiedciaran

    amplifiedciaran

    Joined:
    Oct 24, 2016
    Posts:
    16
    When I install my app with VR disabled on a Samsung S7 or S8 the screen asking to be placed in a Gear VR headset still gets displayed. My manifest is set up for Cardboard but it seems to me it is somehow getting changed when I go to build. What could be forcing this change? Has anybody else experienced this? I have checked my project for other Manifests that might be included with the OVR platform plugin etc that might try and merge with my manifest but cannot find any.

    This is Unity 5.6.2 and 5.6.3 btw

    Update: After removing the OVR Unity Utilities folder from my project I can now build non VR and Cardboard apps again, this is frustrating as I want one project to deploy to multiple VR APKs on the different platforms. I need this OVR Utilities for GearVR controller support, so at the moment it means reinstalling the packages any time I want to build to GearVR.
     
    Last edited: Sep 4, 2017
    Aldo-V likes this.
  2. BlackBox_Team

    BlackBox_Team

    Joined:
    Feb 15, 2017
    Posts:
    16
    Check the API order in your Player Settings. Is Oculus listed before OpenVR? If so, it may be trying to use that API first when you have OVR utilities installed.

    If this is the case, move Oculus under OpenVR when you want to build for cardboard. When you want to build for Gear VR move Oculus to the top.

    I don't do much in the Mobile VR sphere so I could be way off base here, but that was my first thought when I read your post.
     
  3. amplifiedciaran

    amplifiedciaran

    Joined:
    Oct 24, 2016
    Posts:
    16
    Thats the thing, the Oculus API isn't even included in my VR SDK's and it still behaves the way I described. Even with Virtual Reality Supported disabled its asks to be placed into a Gear. Something in the OVR Platform Utilities is overwriting the build setting and Manifest.
     
  4. BlackBox_Team

    BlackBox_Team

    Joined:
    Feb 15, 2017
    Posts:
    16
    That's strange. I have not used the OVR platform utilities but it does appear to be the culprit. I will have to have a look into it when I get the chance.
     
  5. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    305
    Thanks @amplifiedciaran Was getting exactly the same issue. Deleting the OVR folder did the trick.

    Wrapping up all OVRManager code in a custom define directive means that I can keep the scripts in place, then switch back to GearVR (copy the OVR folder back into the project) and all works fine.
    This free Custom Define Manager makes this a breeze https://www.assetstore.unity3d.com/en/#!/content/76634
     
  6. joschi27

    joschi27

    Joined:
    Jul 31, 2016
    Posts:
    8
    For anyone still needing a fix; I've been on this problem for quite some time now. The fix with excluding oculus .aar files did not work for me, so i came up with a solution myself;

    The problem is this line in your android manifest:
    <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only" />
    It starts the gear vr prompt on supported samsung devices. Even if you are building for cardboard, this line is in the manifest.

    How to fix:

    Build the app > Get output from manifest-main.xml in Temp/StagingArea > add this line inside the <application> Tags:

    <meta-data android:name="com.samsung.android.vr.application.mode" android:value="dual" tools:replace="android:value" />
    OR
    <meta-data android:name="com.samsung.android.vr.application.mode" tools:remove="android:value" />

    ... Or export the whole project to android studio and go to the merged manifest, remove the value by hand.

    And you're done.

    If somebody could tell oculus about this problem, that'd be nice. I've tried, they dont seem to care much about bugs.
     
  7. Chris-KillerSnails

    Chris-KillerSnails

    Joined:
    Oct 6, 2017
    Posts:
    2
    I my case, we had a VR app, which we wanted to test on Samsung device with Google Cardboard and not have the GearVR dialog to pop up.

    I had to add a bunch of stuff besides the just "tools:replace" or "tools:remove" to the com.samsung.android.vr.application.mode meta-data, otherwise it would not show up in the manifest and it would also remove some other things which caused the app's icon not to not appear when installed on a device. I finally ended up with an AndroidManifest.xml that worked for me:

    Code (XML):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
    3.   <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    4.   <application android:allowBackup="true" android:icon="@drawable/app_icon" android:label="@string/app_name" android:supportsRtl="true" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner" android:roundIcon="@drawable/app_icon_round" android:theme="@style/VrActivityTheme">
    5.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
    6.       <intent-filter>
    7.         <action android:name="android.intent.action.MAIN" />
    8.         <category android:name="android.intent.category.LAUNCHER" />
    9.         <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
    10.       </intent-filter>
    11.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    12.     </activity>
    13.     <meta-data android:name="com.samsung.android.vr.application.mode" android:value="dual" tools:replace="android:value" />
    14.   </application>
    15. </manifest>