googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.09k forks source link

Cardboard Unity sdk cant stop tracking on Android #1005

Closed zbzdys closed 5 years ago

zbzdys commented 5 years ago

I cant find the answer for my "stop tracking on Android" so i post a issue here try to get your official response.

I have the latest googlevr cardboard sdk for unity and i have finished most of the work. The problem is the hardware test found that the gyro is always running even though turning off the screen. The mobile phone is Huawei P10 which running on Android 8.1 and the gyro costs 150mA even though the cardboard app is suspended.

I noticed that on ios or android ndk, you can use the api of pause or resuming tracking but i did not find that api at the unity sdk. So what i did try to solve the problem? i tried to switch to none vr mode if the app lose focus but no help.

Is gyro used by google vr still working(tracking) when the app is suspended(lose focus)?

I want to get some help for controlling tracking on Android platform. if its a specific problem of different hardward or i did something wrong, please correct me. Thank you.

rusmaxham commented 5 years ago

GoogleVR disconnects from the motion sensors subsystem when the app is suspended. If it is continuing to run, it may be some system issue where these systems don't shut down immediately.

Do you notice any difference in power drain if you kill the cardboard app, not just suspend it?

zbzdys commented 5 years ago

I will try get more hardware power test about the difference of "killing" or "suspending".

Now that Unity intergrates GoogleVR Cardboard SDK, it maybe the problem of the engine , so i post a thread at the unity forum too.

Our new test shows that once we started our cardboard app, in the next two hours off-screen test, the gyro didnot stop working. This costs too much power and the cell phone is hot.

zbzdys commented 5 years ago

I have solved the problem and it was my fault. I use gyro enabled but unity does not suspend this "Rotation Vector Sensor" when loses focus. After adding my disable gyro when losing focus, the sensors can be closed correctly. Sorry to disrupt, now close this issue please.

zbzdys commented 5 years ago

My blog about this problem is https://blog.csdn.net/u012911347/article/details/87878270