2018年10月18日星期四

在Vive Focus上安装2D App

Vive Focus作为一款一体机VR设备,质感还不错。不过由于生态的问题,可用的内容并不多。
如果能引入Android生态中的2D应用感觉会好一些。
但是,截至到目前,消费者版的Vive Focus还不支持2D应用。
具体表现为:可以通过adb install安装APK,但是在home中并没有相应的图标。这样也就无法启动了。当然,可以通过adb shell am start来进行启动,但是每次都要借助PC,还要记包名,就比较痛苦了。
思来想去,决定采用一个比较迂回的方式来解决。
先寻找一个比较简单的2d launcher。
然后通过一个AndroidManifest中包含<category android:name="com.htc.intent.category.VRAPP" />的应用来发送Intent启动之前安装的2d launcher。
实际弄了之后,效果还不错。

Launcher实在github上面找到的一个非常简洁实用的优秀开源项目:
https://github.com/arnabc/simplelauncher
如果想要自己编译的话,可能需要稍微修改一下androidmanifest
<intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <!-- The following two intent-filters are the key to set homescreen    <category android:name="android.intent.category.HOME" />    <category android:name="android.intent.category.DEFAULT" />     -->    <category android:name="android.intent.category.LAUNCHER" />
将主activity的HOME 和 DEFAULT注释掉,添加LAUNCHER。不改可能也行。
感兴趣的同学可以自己试试。
懒得自己编的:https://github.com/SimonTheCoder/simplelauncher/releases/download/init_test/SimpleLauncher-debug.apk

用作启动器的VR应用直接使用了wave vr sdk中的wvr_hellovr。
下载:https://github.com/SimonTheCoder/simplelauncher/releases/download/init_test/app-debug.apk

这个代码稍微有一些改动,就是在hellovr.cpp里面的moveSphereHandler中添加了一个发送intent的反向JNI调用
懒得往git上传了。如果需要的人多的话再说吧。

使用方法:
下载或者编译上面两个apk。
adb install安装之。
启动wvr_hellovr,点击场景中的大球,即可启动simplelauncher。

之后再装个moonlight,工作正常哦!惊不惊喜,意不意外?
https://github.com/moonlight-stream/moonlight-android/releases

没有评论:

发表评论