Jump to content

Programmatically installed application gets to the list of 2D apps (Vive Focus 3)


Recommended Posts

Hello. I have a build of my Unity VR application for Vive Focus 3 that appears in the list of VR apps and works fine in case when it was installed from apk manually. But when I try to install it programmatically it gets to the list of 2D apps and doesn't work properly. AndroidManifest.xml for this app looks as follows:

<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="30" android:compileSdkVersionCodename="11" android:installLocation="auto" package="com.my.package.name" platformBuildVersionCode="30" platformBuildVersionName="11">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true"/>
    <uses-feature android:glEsVersion="0x00030002"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
    <uses-permission android:name="vive.wave.vr.oem.data.OEMDataRead"/>
    <uses-permission android:name="vive.wave.vr.oem.data.OEMDataWrite"/>
    <application android:extractNativeLibs="true" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:theme="@style/Theme.WaveVR.Black">
        <activity android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:enableVrMode="@string/wvr_vr_mode_component" android:hardwareAccelerated="false" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.htc.vr.unity.WVRUnityVRActivity" android:resizeableActivity="false" android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <category android:name="com.htc.intent.category.VRAPP"/>
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
            <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>
        </activity>
        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="true"/>
        <meta-data android:name="unity.launch-fullscreen" android:value="true"/>
        <meta-data android:name="unity.allow-resizable-window" android:value="false"/>
    </application>
</manifest>


Programmatically installation perfoms by another app that serves as launcher to the first app. Launcher is a common Android application that was written using .NET MAUI framework. It appears in the list of 2D apps on device. Here is installation script from this launcher:

            var context = Android.App.Application.Context;
            Java.IO.File apkFile = new Java.IO.File(apkPath);
             
            Intent intent = new Intent(Intent.ActionInstallPackage);
            var uri = Microsoft.Maui.Storage.FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".fileProvider", apkFile);

            intent.SetDataAndType(uri, "application/vnd.android.package-archive");
            intent.AddFlags(ActivityFlags.NewTask);
            intent.AddFlags(ActivityFlags.GrantReadUriPermission);
            intent.AddFlags(ActivityFlags.ClearTop);
            intent.PutExtra(Intent.ExtraNotUnknownSource, true);
            intent.PutExtra(Intent.ExtraReturnResult, true);

            MainActivity.Instance.StartActivityForResult(intent, requestCode);

My guess is that some data from AndroidManifest.xml is lost/not used during installation. As I know, this entry makes application to show up as a vr app on device:

<category android:name="com.htc.intent.category.VRAPP" />

It looks like installation from launcher ignores this category.

I will appreceate any help with this issue.

Link to comment
Share on other sites

On 5/30/2024 at 11:46 PM, RodionovID said:

Here is installation script from this launcher:

            var context = Android.App.Application.Context;
            Java.IO.File apkFile = new Java.IO.File(apkPath);
             
            Intent intent = new Intent(Intent.ActionInstallPackage);
            var uri = Microsoft.Maui.Storage.FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".fileProvider", apkFile);

            intent.SetDataAndType(uri, "application/vnd.android.package-archive");
            intent.AddFlags(ActivityFlags.NewTask);
            intent.AddFlags(ActivityFlags.GrantReadUriPermission);
            intent.AddFlags(ActivityFlags.ClearTop);
            intent.PutExtra(Intent.ExtraNotUnknownSource, true);
            intent.PutExtra(Intent.ExtraReturnResult, true);

            MainActivity.Instance.StartActivityForResult(intent, requestCode);

Your app is built from Android Studio?

Link to comment
Share on other sites

Hello,
@VIVE_chengnay.

After install my app in 2D category.

Yes, my app  is built from Unity.

I believe that my app's AndroidManifest.xml is not modified. Can you share a link to your  SDK's template?

My launcher app is build from Visual Studio.

 

I have another guess. My launcher app is parent activity for VR app during installation.  Because of launcher app is 2D, VR app somehow inherits category from it. Is this possible?

 

Link to comment
Share on other sites

Hi @RodionovID,

You can find the AndroidManifest.xml template from Library\PackageCache\com.htc.upm.wave.xrsdk@<version>\Runtime\Android\AndroidManifest.xml.

3 minutes ago, RodionovID said:

I have another guess. My launcher app is parent activity for VR app during installation.  Because of launcher app is 2D, VR app somehow inherits category from it. Is this possible?

You did mention if you manually install from "adb install", your app is installed as 3D?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...