Build Android VR App in Unity
Modify AndroidManifest.xml (for unity plugin version 0.6.4 or before)
Note that below step is applicable to plugin version 0.6.4. Typical device is DPVR M2 and M2 pro. It does not support P1.
The file name of the certificate is different for different app IDs and device IDs, which means that if multiple certificates are placed in the folder Assets/Plugins/Android/assets, the same app can be issued with multiple certificates. So that the same app can be running on multiple devices.
Open file Assets/Plugins/Android/AndroidManifest.xml in editor
Fill in the "Developer ID" and "APP ID", which can be found in the "Download License" application page from here, accordingly. Note that the ID is the digits following \0.
<meta-data android:name="DPN_DEVELOPER_ID" android:value="\0XXXXXXXX" />
<meta-data android:name="DPN_DEVELOPER_APP_ID" android:value="\0YYYYYYYY" />
Replace the XXXXXXXX with your Developer ID and YYYYYYYY with your APP ID. \0 must be kept.
As shown in below picture, the Developer ID is 1000001 and APP ID is 100000001 respectively. \0 must not be removed.
Pick a package name and fill in the field. When picking a package name you should strive to make it unique as errors will arise if two apps have the same one.
Modify AndroidManifest.xml (for unity plugin version 0.7.0 or later)
Note that below step is applicable to plugin version 0.7.0 or later. Typical device is DPVR P1. If one does not need DPVR certification on M2 or M2 pro, he can use this plugin as well.
The AndroidManifest.xml will be replaced by default during plugin-import stage. However, if one want to use self-defined AndroidManifest.xml, below is the changes needed to make on this file to make the VR App running on DPVR All-in-One VR devices correctly.
Please refer to the plugin Assets\Plugins\Android\AndroidManifest .xml
1) Inherit from class DpvrActivity
If the game inherits from UnityPlayerActivity, please change the inheritance to inherit from com.dpvr.sdk.DpvrActivity; If the game does not inherit from UnityPlayerActivity, please set com.dpvr.sdk.DpvrActivity as the main Activity
2) Add the following meta data to declare this application as a VR application.
<meta-data android:name="com.softwinner.vr.mode" android:value="vr"/>
3) Add a VrListener statement
3.a) for unity plugin 0.7.0-0.7.2c
<service android:name="com.aw.vrsdk.VrListener" android:permission="android.permission.BIND_VR_LISTENER_SERVICE"> <intent-filter> <action android:name="android.service.vr.VrListenerService" /> </intent-filter> </service> |
3.b) for unity plugin 0.7.2d or later
<service android:name="com.dpvr.aw.vrsdk.VrListener"
android:permission="android.permission.BIND_VR_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.vr.VrListenerService" />
</intent-filter>
</service>
Setting up Android SDK and JDK path
Open Edit->Preferences->External Tools and set Android SDK and JDK path
Build the App
Open File->Build Settings and select "Android" platform. Click "Switch Platform". Please choose "ETC2" for "Texture Compression"