Search Unity

Daydream's native "x" quit button doesn't quit the application

Discussion in 'Daydream' started by Mrcojo, Nov 26, 2016.

  1. Mrcojo

    Mrcojo

    Joined:
    Feb 10, 2013
    Posts:
    1
    Hello all.

    My appliction shows the UI for Daydream (with the "x" quit button at the top left and the "wheel" settings button at top right).

    When I press the "x" quit button though, the application doesn't quit.
    This fucntionality works with other Daydream application (like the main Daydream app), so I don't think it's a problem of the SDK itself.

    I guess I'd have to regiter to some event from the SDK or something like that?

    I had this problem before with the Cardboard SDK, if I am not wrong, but I remember being able to find a way to make it work. But now, finding anwers for the Daydream SDK seems a little more difficult.

    Also, I have been away from Android dev for a while, so my memory need some refresh ;)

    Any help would be much appreciated.

    Cheers,
    Marco
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Is your app using the Google SDK for Unity?
     
  3. mpatience

    mpatience

    Joined:
    Oct 31, 2016
    Posts:
    1
    Not the original poster but I have the same issue. I am using the latest Google Daydream SDK and the Unity Daydream Technical Preview to build. I can confirm that pressing the 'X' doesn't exit the application for me.
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Try adding this script to your project and assign it to any GameObject:

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class BackHandler : MonoBehaviour {
    6.  
    7.     void Awake() {
    8.         Input.backButtonLeavesApp = true;
    9.     }
    10.     // Use this for initialization
    11.     void Start () {
    12.         Debug.Log("Starting up BackHandler");  
    13.     }
    14.    
    15.     // Update is called once per frame
    16.     void Update () {
    17.         if (Input.GetKeyUp(KeyCode.Escape)) {
    18.             Debug.Log("Goodbye cruel world!");
    19.             Application.Quit();
    20.         }
    21.     }
    22. }
    23.  
     
    jgwinner and UmairEm like this.
  5. benvu3d

    benvu3d

    Joined:
    Mar 9, 2015
    Posts:
    6
    @joejo we think some recent changes to Daydream has made all of our updates get rejected by Daydream reviewers citing the "X" and "Back Button" won't exit the Daydream app to 2D. Using what you recommended had previously worked but as of 4/13/17, our apps keep going back to Daydream Home. This is happening with using 5.4.x, 5.6 and the new Unity 2017.1 beta (even though it's noted as issue #893219). We're hoping there's a hotfix coming for 5.6 for this issue.
     
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Are you not getting the escape key code? When you say Daydream, do you mean the Unity integration, Google VR SDK for Unity or the actual system components shipped with Android?

    Nothing at all has changed in 5.4 since GVR13 was release which leads me to believe that whatever issue you are seeing is most likely with the SDK or the System OS components. If you can narrow that down for me I can see about getting some help from Google.
     
  7. benvu3d

    benvu3d

    Joined:
    Mar 9, 2015
    Posts:
    6
    @joejo We are using the Google VR SDK for Unity. We've upgraded to Unity 5.6 and GVR 1.4 and here's what happens when we hit X or back button: application goes to Daydream Home for 2 seconds, then goes to Android desktop 2D. Then every subsequent X or Back Button from within our VR app, it goes only to Daydream Home and stays there. Attached is our ADB log file of when the close button is being pressed.

    Note that we're testing on Pixel phones with Android 7.1.2 with latest VR & Play updates from Google.
     

    Attached Files:

  8. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Code (csharp):
    1. 04-21 10:29:48.920: I/ControllerService(2181): Removing listener 10213:25742:com.google.vr.internal.controller.LISTENER_KEY for controller 0.
    2. 04-21 10:29:48.921: I/ActivityManager(1105): Process net.skyvu.placesvr (pid 25742) has died
    3. 04-21 10:29:48.921: D/ActivityManager(1105): cleanUpApplicationRecord -- 25742
    4. 04-21 10:29:48.920: I/WindowManager(1105): WIN DEATH: Window{f797cf6 u0 SurfaceView - net.skyvu.placesvr/com.unity3d.player.UnityPlayerActivity}
    5. 04-21 10:29:48.933: I/WindowManager(1105): WIN DEATH: Window{624a958 u0 net.skyvu.placesvr/com.unity3d.player.UnityPlayerActivity}
    6. 04-21 10:29:48.934: W/WindowManager(1105): Force-removing child win Window{71158f7 u0 SurfaceView - net.skyvu.placesvr/com.unity3d.player.UnityPlayerActivity} from container Window{624a958 u0 net.skyvu.placesvr/com.unity3d.player.UnityPlayerActivity}
    7. 04-21 10:29:48.952: W/WindowManager(1105): Failed looking up window
    8. 04-21 10:29:48.952: W/WindowManager(1105): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@2b10a5 does not exist
    9. ...
    10. 04-21 10:29:49.054: I/sensors(1105): batch
    11. 04-21 10:29:49.057: I/Zygote(673): Process 25742 exited due to signal (11)
    12. 04-21 10:29:49.057: I/nanohub(1105): queueBatch: sensor=1, handle=1, period=2500000, latency=0
    13. 04-21 10:29:49.642: D/audio_hw_primary(508): disable_audio_route: usecase(1) reset and update mixer path: low-latency-playback speaker
    14. 04-21 10:29:53.764: W/PlatformStatsUtil(5717): Could not retrieve Usage & Diagnostics setting. Giving up.
    Looks like there is a hang or crash or something that may be causing the app to not quit correctly. What changed on 4/13 that you are aware of? Did you update Unity? Google VR SDK? If you did, can you try backing up to what you had previously and see if that resolves the issue?
     
    benvu3d likes this.
  9. benvu3d

    benvu3d

    Joined:
    Mar 9, 2015
    Posts:
    6
    @joejo FWIW we tried using the "X" and "Back" buttons in other Daydream apps built with Unity (vTime, Tiny War, and Moatboat) and we experienced the same exact issue of going to Daydream Home for 3 seconds then closing to desktop 2D. Then on subsequent X/Back Button presses, it only goes to Daydream Home and stays there.
     
  10. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Ahh... 3 seconds. Ok, I may know what is hanging there (we've seen a deadlock that times out after 3s but not sure the why of it completely) but I don't know the why, especially why it started happening on 4/13. What happened then? Was there an OS or VrCore update then?

    After the first run and 3s shutdown can you press the "square" nav button, manually kill the app, restart it and then hit the X button? I'd like to see if that changes the "Then on subsequent X/Back Button presses, it only goes to Daydream Home and stays there." issue.
     
  11. benvu3d

    benvu3d

    Joined:
    Mar 9, 2015
    Posts:
    6
    @joejo We tested that way as well using the "square" nav button then manually killing the app. And we're still getting the same issue of it not fully quitting out of Daydream Home.
     
  12. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    At this point I am unsure what happened to cause this to occur. You say this started happening on 4/13 with your app and other apps that (I presume) are not yours and not built by you or your team. So without knowing what happened on 4/13 I can't even tell you what may be causing the issue to arise or if it can be fixed locally.

    Can you at lest provide a simple repro project that you know reproduces the issue for you and let me see if I can repro the same problem here?
     
    benvu3d likes this.
  13. benvu3d

    benvu3d

    Joined:
    Mar 9, 2015
    Posts:
    6
    @joejo We are putting together a simple repro to send your way. We really appreciate your help. As a basic test, we built the demo scene with 5.6 and GVR 1.4 and were able to exit to desktop 2D using the X & Back buttons. So there's something going on in our app that we need to pinpoint. Have a great weekend!
     
  14. Captain-Awesome

    Captain-Awesome

    Joined:
    Jul 29, 2014
    Posts:
    28
    Have you tried challenging the rejection? Usually they give me a more detailed response when I do, sometimes with screenshots.
     
  15. QuentinLG

    QuentinLG

    Joined:
    Jun 29, 2016
    Posts:
    9
    Hi @benvu3d ,
    We just got the same issue (rejection from Daydream store for closing issue) and I found a work-around.

    From what I understand, when the user closes the app (either using the cross "x" or the back button) they want the app to close immediately (which is a completely legit requirement). But they also want whatever pops-up after (i.e. what the user was seeing just before he launched the app) to be 2D (as opposed to a 3D VR app). This requirement doesn't make much sense, as you don't have control over other apps. And if the user was in the Daydream Home app and in VR mode when he launched your app then he will return to the Daydream Home (and still in VR mode) when he closes your app. This is the normal (and expected) behavior, but that goes against their requirements.

    Now what seems to work for us is calling "UnityEngine.VR.VRSettings.enabled = false;"just before "Application.Quit();". When doing this the Daydream Home app closes itself (for some unknown reason). This effectively put the user on the Android launcher and in 2D (fulfilling the requirement).
    I don't know why Daydream Home closes itself when "UnityEngine.VR.VRSettings.enabled = false;" is called before killing the app, I don't see any logical reason this should happen. But it does...
     
  16. colin-dumitru

    colin-dumitru

    Joined:
    Feb 18, 2017
    Posts:
    2
    Hi everyone,

    Unfortunately, I'm facing the same issues as @benvu3d with Unity 5.6 and GoogleVRForUnity 1.4. When exiting the app, the Daydream Home page opens for a few seconds, and then finally exits to the 2D Launcher. It seems to be a problem with Unity itself (or the GoogleVR SDK), because I've created a clean new project, imported the GogoleVR SDK, and the test application behaves the same way (pressing the X button will open the Daydream Home page for a few seconds).

    I've tried the solution @QuentinLG suggested, but it doesn't seem to fix the issue. The code I'm currently using is taken from the DemoInputManager script:

    Code (CSharp):
    1.   void LateUpdate() {
    2.     GvrViewer.Instance.UpdateState();
    3.     // Exit when (X) is tapped.
    4.     if (Input.GetKeyDown(KeyCode.Escape)) {
    5.       Application.Quit();
    6.     }
    7.   }
    It's been really frustrating trying to publish my app to the Daydream store, as some of the feedback returned from Google is either really ambiguous or there's no documentation on how to fix the issue (like in this example).
     
  17. QuentinLG

    QuentinLG

    Joined:
    Jun 29, 2016
    Posts:
    9
    From what I understand having Daydream Home close itself (after a few seconds) is fine for the requirement:

    "FN-A2: App closes from VR correctly
    Pressing the Close close button or the Back button in the system bar (accessible if the user removes their phone from the viewer) should immediately pause the application, including any audio that was playing. User and app state should be handled in a reasonable way. The user should be taken to the 2D phone launcher."

    They are very ambigous on what "2D phone launcher" means, but for me it means the normal android app launcher (not the daydream one). Also I tried and downloaded one of the featured app, and Daydream Home does close when you quit the app.

    Also, for me calling just "Application.Quit();" doesn't close Daydream Home, and I think that's why they rejected our app.
    Our new build got rejected for an other new reason, so I guess they consider the closing issue resolved ^^'.
     
  18. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Perhaps same issue - with GVR 1.4 and Unity 5.5.1 in this case - the X button does nothing at all in cardboard - does not send the key event that pressing the android back button does. Seems GVR at fault
     
  19. AlexHolderDev

    AlexHolderDev

    Joined:
    Jul 2, 2014
    Posts:
    35
    Suffering from this issue too, using Unity 2017.2.0f2 and GVR 1.100.1. It's preventing me from publishing to Daydream with this exact review message: "When in VR, your app should never display any 2D images. Tapping on "Close Game" within the pause menu brings the user to the 2D Android home screen. It must return to the Daydream home screen."

    Doesn't match up with FN-A2 letting us exit to 2D! :( Might just have to argue over that point once I fix the other app review issues.
     
  20. wojwen

    wojwen

    Guest

    Same issue here. I'm using Unity 2017.1.1f GVR 1.70. I've just started a beta of my game and I got Provisional Pass which means that I's on the Daydream store, but I have to fix eligibility issues before releasing the final version. Do you have any experience with this? Does my app get reviewed evey time I submit new APK?
     
  21. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Your app gets reviewed every time you change anything about it and the reviews are extremely arbitrary.

    For example, I logged in to Google Play Console to look at analytics for a game that has already been live on Daydream for a while. While I was there, it prompted me to accept some new terms of service agreement or something like that. So I checked the "accept" box and saved my changes. A couple of hours later, our app, which had NOT even changed for months, was REJECTED from Daydream due to something being out of focus on the photosphere image for its entry in the store listing.

    So I shouldn't have touched anything.

    We've wrestled with these things from the beginning. We were rejected at one point for not having a stable horizon. I replied asking for clarification (because we do have a stable horizon) and never got an answer. I uploaded a new APK to fix something totally unrelated to that "problem", and the app was APPROVED. Never got an answer about the original rejection.

    But to answer your question, yes, it will get reviewed again every time you submit an APK.
     
  22. sterlingcrispin

    sterlingcrispin

    Joined:
    Oct 23, 2013
    Posts:
    18
    FWIW I upgraded from an older SDK to the most recent and was missing this requirement. Adding "DemoSceneManager.cs" to any game object will solve this issue:

    The app does not exit when a user selects the home or back button
     
  23. unity_fvH2-MMGIWTywA

    unity_fvH2-MMGIWTywA

    Joined:
    Dec 7, 2017
    Posts:
    3
    Thank you buddy. Your solution helped many. Thank you again.