New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Solution for kiosk mode on Oculus Go

AlexEvgrashinAlexEvgrashin Posts: 5
NerveGear
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.
«1

Comments

  • RJdoesVRRJdoesVR Posts: 50 Oculus Start Member
    This is awesome, great find! I'll be trying this out on a work project this week. 
  • mskdhitest1mskdhitest1 Posts: 2
    NerveGear
    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?
  • TomCHallTomCHall Posts: 32 Oculus Start Member
    This definitely should be an official feature! At the very least for business licence holders!
  • AlexEvgrashinAlexEvgrashin Posts: 5
    NerveGear
    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.
  • mskdhitest1mskdhitest1 Posts: 2
    NerveGear
    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_devundef_dev Posts: 19
    NerveGear
    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.

  • AlexEvgrashinAlexEvgrashin Posts: 5
    NerveGear
    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?
  • callenshawcallenshaw Posts: 5
    NerveGear
    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.9klaus.kobald.9 Posts: 5
    NerveGear

    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? 
  • klaus.kobald.9klaus.kobald.9 Posts: 5
    NerveGear
    maybe a dumb question - but how can I add this to the manifest? 
    [....]
    ok - I found the skeleton manifest inside androidplayer inside unity app. Using that and adding your code does work!
  • klaus.kobald.9klaus.kobald.9 Posts: 5
    NerveGear
    Before I break things:
    How would I restore the original Home App?
    like so?
    What is the activity?
    adb shell cmd package set-home-activity com.oculus.vrshell.home/com.unity3d.player.UnityPlayerActivity

    Is this a correct manifest?
    <?xml version="1.0" encoding="utf-8"?>
    <manifest
        package="com.oculus.UnitySample"
        android:installLocation="preferExternal">

        <application
            android:theme="@style/UnityThemeSelector"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name">;
            <activity android:name="com.unity3d.player.UnityPlayerActivity"
                      android:label="@string/app_name">;

    <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>
            </activity>
        </application>
    </manifest>

  • Cyberben3dCyberben3d Posts: 6
    NerveGear
    @klaus.kobald.9
    I'm not sure if your method to restore the original Home app works but I just uninstalled my APK and the original home started to come up automatically.

    adb uninstall <your package name>
  • julierthanjuliejulierthanjulie Posts: 1
    NerveGear
    Any tips on how to override the "enter vr" screen?  I'm hoping users won't end up seeing it, but if they do I want it to match the in game experience.
  • callenshawcallenshaw Posts: 5
    NerveGear
    Not sure what happened, but this solution to run as a launcher on startup is no longer working. The headset won't boot properly now. In this reddit thread someone claims that after an update a couple days ago this solution was broken. So we're back to square one - has anyone found an alternate route?
  • oconeloconel Posts: 2
    NerveGear
    They say on http://oculusgokioskmode.undef.ch/
    "(Edit: 8th of August 2018) Somehow a newer update from Oculus breaks the install-script. Execute it anyway or run it line by line. See troubleshooting below."

    Does this works to fix it ?
  • nikonutschnikonutsch Posts: 3
    NerveGear
    dear forum

     has anybody any experience with http://oculusgokioskmode.undef.ch/ and the use of the oculus browser.
    the command line setup works fine and the user logo appears instead of the oculus startup,
    but switching to oculus browser does not work.
    is it possible, that oculus browser does need vr shell for running....
    wbr
    klaus
  • GabrioGabrio Posts: 5
    NerveGear
    edited August 13
    dear forum

     has anybody any experience with http://oculusgokioskmode.undef.ch/ and the use of the oculus browser.
    the command line setup works fine and the user logo appears instead of the oculus startup,
    but switching to oculus browser does not work.
    is it possible, that oculus browser does need vr shell for running....
    wbr
    klaus
    How did you do it? Did you found problems installing the app?
    I've followed the instruction, but after the ended of the batch process, the device rebooted and it entered in a loop with the message "Application start stopped, click to close."
    The problem occur when I install the oculusgokioskmode.apk and reboot the device.
    Any idea?

    EDIT: 
    Finally I managed it to work. The only thing is now to disable o prevent the long press Power button :(
  • callenshawcallenshaw Posts: 5
    NerveGear
    Gabrio said:
    How did you do it? Did you found problems installing the app?
    I've followed the instruction, but after the ended of the batch process, the device rebooted and it entered in a loop with the message "Application start stopped, click to close."
    The problem occur when I install the oculusgokioskmode.apk and reboot the device.
    Any idea?

    EDIT: 
    Finally I managed it to work. The only thing is now to disable o prevent the long press Power button :(
    Gabrio, could you elaborate on your solution? I've been stuck at the boot-loop since the last update which broke the kiosk mode apk.
  • undef_devundef_dev Posts: 19
    NerveGear
    @callenshaw @gabrio we just released a windows application for making the installation more easy. should also be more solid. let us know if the new demo fixes your issue. Perhaps try a clean install and do a factory reset first. https://oculusgokioskmode.tweaklab.org/

  • nikonutschnikonutsch Posts: 3
    NerveGear
    dear people 
    for those how want to use a browser in kioskmode: with firefox vr browser and undef def-s kiosk solution
    it does work.
    wbr
    klaus
  • hclmedhclmed Posts: 6
    NerveGear
    @AlexEvgrashin These techniques are helpful for avoiding the enter VR screen and keeping an app active, but there still needs to be a way to prevent sleep time out after 15 seconds. The idea of simulating the press of the volume button periodically seems like a possible solution. Has anyone found a way to do that?
  • JonnyboybabyJonnyboybaby Posts: 6
    NerveGear
    Can someone help me with the AndroidDaemonService? I'm new to android and don't know the language at all. I've been trying to figure it out but still cant get it.
    What do I assign the instance to?
    Is there anything I have to change in the xml file?

    package com.android.service;

    import android.app.Service;
    import android.content.Intent;
    import android.os.IBinder;
    import android.widget.Toast;

    public class AndroidDaemonService extends Service {

    public static AndroidDaemonService instance;
    private AndroidDaemonService() {
    }
    public static AndroidDaemonService getInstance() {
    if(instance == null) {
    instance = this;
    }
    return instance;
    }
    }
  • VeeRDevVeeRDev Posts: 4
    NerveGear
    I just downloaded undef_dev's kiosk demo but all I get after loading my apk is a black screen with a banner at the bottom labeled Oculus Kiosk demo. Am I missing something? I was expecting my app to play with a watermark as stated..
  • storzmedienfabrikstorzmedienfabrik Posts: 3
    NerveGear
    @undef_dev I've just installed the demo version of your kiosk application and now I'm stuck at a black screen that shows the watermark "OculusGo KioskMode Demo" and nothing else happens.
    I've selected a package via the Manage Apps tab and the Output window says "APP SELECTED Package: xx.xxxx.xxx.xxx"
    Do I need to do anything else to confirm the selection?
  • storzmedienfabrikstorzmedienfabrik Posts: 3
    NerveGear
    @VeeRDev I have the same problem, did you find a solution?
  • GabrioGabrio Posts: 5
    NerveGear
    @storzmedienfabrik I've the full version, but I think should work also with the demo.
    I was able to put the OculusGo in Kiosk just doing this steps:
    1. tab "Manage Apps" -> Select the apk to install -> click "Install"
    2. tab "KioskMode" -> Select the image to overlay (click volume button) -> select the package from the dropdown (the one you installed before) -> click on Apply
    3. tab "KioskMode" -> Click on "Install"
    Done.
    If needed you may reboot the device using the button on the top right corner.
    For me worked on 4 OculusGO

  • storzmedienfabrikstorzmedienfabrik Posts: 3
    NerveGear
    @Gabrio Thanks so much! This helped me a lot, I have installed the apk via Manage Apps, but I wasn't aware of the apply button in the settings of the KioskMode tab. You're my hero for today!
  • Cyberben3dCyberben3d Posts: 6
    NerveGear
    Are you guys able to get KioskMode working after the 3.49 firmware update? (the one that just came out with the new Power Settings to disable the proximity sensor and "never sleep") Sadly the autolaunch doesn't work anymore and KioskMode doesn't seem to work either. I just get "Oculus System has Stopped". Tried factory reset and following the exact steps above @Gabrio @storzmedienfabrik @undef_dev

  • VeeRDevVeeRDev Posts: 4
    NerveGear
    @Gabrio Works now. Thanks for the detailed step by step.
  • AttackingHoboAttackingHobo Posts: 20
    Brain Burst
    Do the original instructions still work? Or is the paid solution the only thing that works?

«1
Sign In or Register to comment.