Search Unity

pause app when headset/controller isn't moving

Discussion in 'Daydream' started by frigi, Jan 19, 2017.

  1. frigi

    frigi

    Joined:
    Jul 15, 2014
    Posts:
    9
    Hey,

    is there a way of pausing a daydream app and wake it up again when needed?
    I have a usecase where multiple headsets would need to sit on a table all the time and occasionally be picked up. Unlocking the phone, starting the app and then pairing the controller each time is way too cumbersome, especially because the users usually have no clue about all of that. Just having it sit there without pausing would drain the batteries way too fast as well (and would possibly introduce heat issues) so that's not really a good option either.

    Due to the lack of a proximity sensor I would like to check if there is any movement of the headset/controller and pause/unpause respectively.

    Would be greatful for any pointers in the right direction!

    Cheers
     
  2. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    Have you tried silly things like setting "Application.targetFrameRate = 1" when the view is looking almost straight down, then raising it back to 60 when the view raises back up? I don't know what the battery drain would be at 1 frame per second but it might suffice for your use case?
     
    Freaking-Pingo likes this.
  3. frigi

    frigi

    Joined:
    Jul 15, 2014
    Posts:
    9
    Disabling the main camera and lowering the framerate to 1 definitely helps quite a bit but I still have to do some more battery drain benchmarking to tell how well it really works. More on that later but maybe it's not that silly after all, thanks! :) I couldn't interactively change the culling mask and clear flags of the camera for some reason unfortunately...

    It would still be great if there was a "better" way of doing it which might also be even more energy efficient. Additional ideas are very welcome!
     
    Last edited: Jan 22, 2017
  4. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    You can do things like that on the individual eye cameras that are spawned beneath your main camera at runtime, or you can use the GVR menu option to pre-spawn those so you can see them in your hierarchy at design time.
     
  5. frigi

    frigi

    Joined:
    Jul 15, 2014
    Posts:
    9
    That makes a lot of sense actually, thanks. Will try that later!
     
  6. Freaking-Pingo

    Freaking-Pingo

    Joined:
    Aug 1, 2012
    Posts:
    310
    @frigi did you have the time to check it out? Did you achieve the sleep/wakeup functionality for the Daydream?
     
  7. frigi

    frigi

    Joined:
    Jul 15, 2014
    Posts:
    9
    Bringing down the fps to a minimum (and disabling the camera) helps a lot already and seems to keep the controller connection alive as well, so that's one way of doing it. I still didn't have a chance to test it properly though, so I don't have any solid numbers on this yet.

    The other thing I tried was acutally sending the device in sleep mode by doing this: Screen.sleepTimeout = SleepTimeout.SystemSetting;

    This of course only works well if you set you screen sleep time to the minimum of 15 seconds in the device settings, so it's only applicable when you have control over the actual devices. Another drawback is that you lose the controller connection (intended behaviour by the system) which makes it less useful to me because that's a big part of what I'm trying to avoid.
    In order to be able to wake it up automatically you would also have to spawn a background android service on the phone. That should be possible though. Otherwise the only way is to press the button and disable the lock screen in the phone settings beforehand.
    Overall this is really nice for the battery drain but introduces a lot of new issues... So still quite far away from what the GearVR does.
     
  8. Captain-Awesome

    Captain-Awesome

    Joined:
    Jul 29, 2014
    Posts:
    28
    Can you not just use the pause button? When you pause just disable everything in your scene, so the phone will do barely any work, rendering an entire scene with no lights or shadows.

    My battery lasts a really long time when I'm just looking around in Streets view. An empty black scene should last even longer.