什么是START_STICKY,START_NOT_STICKY和START_REDELIVER_INTENT服务 [英] What is START_STICKY,START_NOT_STICKY and START_REDELIVER_INTENT Service

查看:529
本文介绍了什么是START_STICKY,START_NOT_STICKY和START_REDELIVER_INTENT服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解

  1. START_STICKY,
  2. START_NOT_STICKY和
  3. START_REDELIVER_INTENT

任何一个可以解释清楚结合的例子。

can any one explain clearly with examples.

我通过来到这个的链接,但无法理解清楚。

i went through this link but couldn't understand it clearly.

在此先感谢。

推荐答案

这些都涉及到的服务。我们都知道,服务不断在后台运行,它们也消耗了一些内存来执行。

These are related to services. We all know that services keeps on running in the background and they also consume some memory to execute.

因此​​,随着越来越多的应用程序在Android设备运行,设备内存不断变低时的发生时间,设备内存变得严重不足时,Android系统启动时终止进程,从而释放占用的内存通过的处理。

So, as more of the application runs on android device, the device memory keeps on getting low and when the time arises, when the device memory gets critically low, the android system starts terminating processes, so as to release the memory occupied by the processes.

但是,你可能会做的服务,这也得到终止该服务停止了一些重要的任务。 等等这些概念都告诉你要执行时,该设备的内存变得稳定,当它已准备好重新启动的服务有什么动作的android系统。

But you might be doing some important task with the services, that could also get terminated as the service stops. so these concepts are to tell the android system what action you want to perform when the device memory gets stable and when it is ready to relaunch the services.

这些最简单的解释是,

START_STICKY - 告诉系统创建的服务,全新副本的时候有足够的内存,它由低内存恢复后。在这里,你将失去,可能以前计算的结果。

START_STICKY- tells the system to create a fresh copy of the service, when sufficient memory is available, after it recovers from low memory. Here you will lose the results that might have computed before.

START_NOT_STICKY - 告诉系统不要打扰重新启动该服务,即使有足够的内存

START_NOT_STICKY- tells the system not to bother to restart the service, even when it has sufficient memory.

START_REDELIVER_INTENT - 讲述了系统崩溃后重新启动该服务,并重新传送的是present的意图在崩溃的时间

START_REDELIVER_INTENT- tells the system to restart the service after the crash and also redeliver the intents that were present at the time of crash.

这篇关于什么是START_STICKY,START_NOT_STICKY和START_REDELIVER_INTENT服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆