cancel
Showing results for 
Search instead for 
Did you mean: 

Solution for kiosk mode on Oculus Go

AlexEvgrashin
Level 3
As it is no built-in way to enable kiosk mode for your custom app, I will share my findings to do it via "hacks". I hope, you will share yours too and together we will solve this problem.

Make your app start at boot
This is relatively easy, thanks to Android OS. You need to add this intent-filters for your activity in manifest file.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
After that, you need to execute this command via adb.
adb shell cmd package set-home-activity <your package name>/<your activity name>
You can find your package name and your activity name in manifest file. After reboot device will start your app!

Disable home button on controller
So even after you changed home activity of your app, home button on controller will still return you to Oculus Home. I guess, it's because system prop "ro.ovr.home_uri". I didn't find a way to change it or disable button without root assess. But you can try this hack.
You will need to override onCreate and onStop of your activity. In onCreate method you have to start your custom service.
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {    
super.onCreate(savedInstanceState, persistentState);
Intent mServiceIntent = new Intent(this, AndroidDaemonService.class);
this.startService(mServiceIntent);
}
AndroidDaemonService is simple service that has static singleton field. You have to write it by yourself.
In onStop method you need to "restart" activity.
protected void onStop() {    
super.onStop();
Context context = AndroidDaemonService.instance;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
launchIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(launchIntent);
}
So after you press home button, device will try to load Oculus home and immediately return to your application. For a user it will look like a white flash. So it's not a perfect solution, but at least it works.

Disable Welcome to VR / Controller callibration
Sadly, I haven't succeeded to solve that yet. Again, it looks like system prop "persist.ovr.wakeupdialog" should do the trick, but I don't know how to change it without root. There exists really robust approach to detect when screen goes on and send command via ADB to simulate volume button press, but I didn't test it yet. This solution need permanent adb connection via USB or via WiFi.
Another way is to delete system app vrpowermanager. It will disable the window, but it also ruins oculus tracking. If you know any solution via broadcast or something else, please share it with others.

If you have any questions about implementation of this approaches, write me PM or email.
46 REPLIES 46

RJdoesVR
Level 4
This is awesome, great find! I'll be trying this out on a work project this week. 

mskdhitest1
Level 2
Thanks for posting! I just started working with the Oculus Go and I've been trying this solution with my Unity app but when i run

adb shell cmd package set-home-activity <your package name>/<your activity name>

I get the following error:



java.lang.IllegalArgumentException: Component ComponentInfo{<my package name>/<my activity>} cannot be home on user 0

Any suggestions?

TomVR
Level 4
This definitely should be an official feature! At the very least for business licence holders!

AlexEvgrashin
Level 3


Thanks for posting! I just started working with the Oculus Go and I've been trying this solution with my Unity app but when i run

adb shell cmd package set-home-activity <your package name>/<your activity name>

I get the following error:



java.lang.IllegalArgumentException: Component ComponentInfo{<my package name>/<my activity>} cannot be home on user 0

Any suggestions?


Check if you have put intent filters inside activity like this
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
<category android:name="android.intent.category.LAUNCHER" />
</activity>
If you use Unity, check if manifest placed correctly in Plugins/Android/AndroidManifest.xml. You can double check that via exctracting .apk or using something like apktool.

mskdhitest1
Level 2
Hi,

Yes, I put the following intents into the activity and I moved the manifest to the correct directory so now it works. Could you explain to me the AndroidDaemonService and how to write it? Sorry I am a beginner at Android as well.

undef_dev
Level 4
We have a KioskMode like Android launcher for download here: http://oculusgokioskmode.undef.ch/ The key feature is a custom overlay (.jpg image file) to hide and override the default "Enter VR" welcome screen.

AlexEvgrashin
Level 3

undef_dev said:

We have a KioskMode like Android launcher for download here: http://oculusgokioskmode.undef.ch/ The key feature is a custom overlay (.jpg image file) to hide and override the default "Enter VR" welcome screen.



Great job with "Enter VR" screen. What about home button on controller? Does uninstalling oculus.home just disable it?

callenshaw
Level 2
I have been testing the solution by undef_dev and while it does solve lots of these issues, it does not handle home button disable. It seems to be targeting kiosk uses of headset only, without requiring the controller, by keeping device in developer mode, to unlock it with volume keys.

It seems to work by uninstalling most oculus UI packages, but what this leads to is a user pressing home, then selecting "Exit to Home" on a system menu, and being thrust into a black scene that cannot be exited without entering and exiting sleep mode (at which point your kiosk app is relaunched successfully).

AlexEvgrashin, is there any chance you could point us toward an explanation of what you mean by "AndroidDaemonService is simple service that has static singleton field. You have to write it by yourself"?

I have some basic android dev knowledge, but have never written a service so I'm not sure what exactly you mean. It sounds like something that would be very minimal (a class with a single field?) but if this was the case I don't see why you would say we have to write it ourselves instead of sharing such minimal code. I'm planning to try and figure this out but any clarification would be greatly appreciated.

Or if you two could work together to get home button handling fixed in undef's solution, I think many on these forums would want to buy it!

klaus_kobald_9
Level 4

maybe a dumb question - but how can I add this to the manifest?
I tried to add an empty manifestfile to Assets/Plugins/Android/AndroidManifest.xml
When I add the intent thingy there it gives me a compile error (android namespace not found ) which seems obvious because it´s not a proper xml.
Then I opened the apk with android studion and copied the contents of manifest into AndroidManifest.xml and tried to build for testing purpose which gives a different error: Resource '@ref/0x7f040000' not found in AndroidManifest.xml:49

How do I do it?