简体   繁体   English

如何防止应用程序进入Delphi XE8的睡眠模式

[英]How can I prevent apps from going into sleep mode in Delphi XE8

I have a multi device Firemonkey project in Delphi XE8 which I use to make iOS and Android apps. 我在Delphi XE8中有一个多设备Firemonkey项目,用于制作iOS和Android应用程序。 If I am running my apps on the devices they sometimes go to sleep if I didn't touch the screen but the app is still loading stuff. 如果我在设备上运行我的应用程序,即使我没有触摸屏幕,但有时应用程序仍在加载内容,它们有时会进入睡眠状态。

So how can I stop the app from going into sleep mode for both Android and iOS? 那么,如何阻止该应用进入Android和iOS的睡眠模式?

There is currently no universal way to prevent a mobile FireMonkey application from going to sleep when user activity is too low. 当前没有通用的方法来防止用户活动太少时移动FireMonkey应用程序进入睡眠状态。

For iOS there is one proposed solution here: XE4 Firemonkey on iOS prevent sleep mode and for Android is another one: Delphi XE5 Android. 对于iOS,这里有一个建议的解决方案: iOS上的XE4 Firemonkey可以防止睡眠模式,而对于Android,则是另一个: Delphi XE5 Android。 How to use PowerManager.WakeLock? 如何使用PowerManager.WakeLock? .

They are using different API calls and methods, so it would be difficult to share the same code. 他们使用不同的API调用和方法,因此将很难共享相同的代码。 You could wrap the functionality into a library and with some ifdef's perhaps invoke it the same way. 您可以将功能包装到一个库中,并且某些ifdef可能以相同的方式调用它。

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

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