如何prevent一个机器人活动被杀

编程入门 行业动态 更新时间:2024-10-27 00:25:14
本文介绍了如何prevent一个机器人活动被杀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经开发了确实需要做不断的网络活动的应用程序。该活动网络是否连接通的AsyncTask的,有时这些工作在后台正在做(应用程序没有焦点)。我的应用程序有时会得到30分钟后死亡,即使系统似乎并不缺乏资源(内存)。

I have developed an application that does require to do constant network activity. This Activity does the network connections thru an AsyncTask, sometime this work being done in background (application not having focus). My application sometimes gets killed after 30 mins, even if the system does not seem to lack resources (memory).

我已经阅读了活动的生命周期中的应用程序基础部分的developer.android ,却找不到答案。什么是正确的方法以编程方式prevent我Activty被杀死。

I have read the Activity life cycle in the Application Fundamentals section on developer.android, but can't find an answer. What would be the proper way to programmatically prevent my Activty to get killed.

感谢你。

推荐答案

如果您使用的服务并确保它保持活跃的(先启动它,根本就没有停止它)的应用程序不会被杀死(除非它是极低的,当然内存)。

If you use a Service and make sure it stays active (by first starting it and simply not stopping it) the application wont be killed (unless it's extremely low on memory of course).

更多推荐

如何prevent一个机器人活动被杀

本文发布于:2023-11-06 21:50:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:被杀   机器人   prevent

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!