简体   繁体   English

从头部取下玻璃杯后,如何使GDK应用保持活动状态

[英]How to have a GDK app stay active after the glass is removed from the head

I am developing an app which requires the gdk program to continue running as-is even after the device is removed from the head. 我正在开发一个需要gdk程序才能继续按原样运行的应用程序,即使将设备从机头上卸下也是如此。 Currently the program is paused when this happens seemingly by default, but I need the program to stay running because it is constantly uploading video. 目前,似乎默认情况下该程序已暂停,但是我需要该程序保持运行,因为它一直在上传视频。 The desired result is that the program will continue to run and upload a video stream even if the glass is removed from the user's head. 理想的结果是,即使从用户的头上取下了玻璃杯,该程序仍将继续运行并上传视频流。

What can I do to change this behavior? 我该怎么做才能改变这种行为?

thank you. 谢谢。

You probably want to perform the long running upload in a background service. 您可能想在后台服务中执行长时间运行的上传。 Android's activity model makes it such that you can't really depend on the life of the activity to always be in the foreground and you need to use a service for tasks that shouldn't be paused. Android的活动模型使您不必真正依赖活动的寿命就永远处于前台,而您需要对不应该暂停的任务使用服务。

Also if you have an activity you want to return to when you put Glass back on, ensure you specify android:immersive="true" within your declared <activity> . 另外,如果您有要在重新启动Glass时返回的活动,请确保在声明的<activity>指定android:immersive="true" Without this, your activity could be completely destroyed when the screen turns off. 否则,屏幕关闭时,您的活动可能会被完全破坏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM