如何阻止应用在Android OS上启动时运行?

Is it necessary to keep your list of startup and running apps lean and mean on Android OS, and if so,  how can you put the brakes on an application heavy startup?

是否有必要在Android OS上保持启动和正在运行的应用程序列表的简洁性和意义,如果是这样,您如何制止应用程序繁重的启动?

Today’s Question & Answer session comes to us courtesy of Android Enthusiasts—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的问答环节由Android Enthusiasts提供,它是Stack Exchange的一个分支,Stack Exchange是一个由社区驱动的问答网站组织。

问题 (The Question)

Android Enthusiast reader Scott Severance is curious about taming his Android startup routine:

Android发烧友读者Scott Severance对驯服Android启动例程感到好奇:

When my phone starts up there are several application/services running in the background that I would rather not. And when I press the Home button while using an app, that app usually goes into the background without exiting. How can I stop these apps from running?

当我的手机启动时,有一些我不希望在后台运行的应用程序/服务。 当我在使用某个应用程序时按“主页”按钮时,该应用程序通常会在不退出的情况下进入后台。 如何停止这些应用程序运行?

What’s the solution and is stopping them always the most efficient method?

解决方案是什么,始终将其停止是最有效的方法?

答案 (The Answer)

SuperUser contributor Matthew Read offers a detailed breakdown of why this may not matter as much as Scott believes, and how Android differs fundamentally from other operating systems in regard to startup apps and background processes:

超级用户撰稿人Matthew Read详细解释了为何这可能并不像Scott所认为的那么重要,以及Android在启动应用程序和后台进程方面与其他操作系统有本质的不同:

第一件事第一 (First Things First)

You may have some misconceptions about how Android works and what’s really happening when a service is running or an app is in the background. See also: Do I really need to install a task manager?

您可能对Android的工作原理以及服务运行或应用程序在后台运行时的实际情况有一些误解。 另请参阅: 我真的需要安装任务管理器吗?

Most apps (e.g., ones you launch manually) have their current Activity put into the background when you switch to another app or the homescreen. Activities consume some memory, so that you can go back to the app and pick up where you left off. Activities are usually not able to run computations in the background, so no CPU or battery is used for them. If battery life or CPU performance is your concern, you don’t need to worry about these apps! You don’t need to worry about memory, either; Android will automatically kill the app and free the memory if the system is running low.

当您切换到另一个应用程序或主屏幕时,大多数应用程序(例如,您手动启动的应用程序)会将其当前的活动置于后台。 活动会占用一些内存,因此您可以返回到应用程序并从上次停下来的地方继续学习。 活动通常无法在后台运行计算,因此无需使用CPU或电池。 如果您担心电池寿命或CPU性能,则无需担心这些应用程序! 您也不必担心内存。 如果系统运行不足,Android将自动终止该应用程序并释放内存。

If the app in background is running a service, that may be a different story. Well-designed services spend most of their time sleeping, waking up for the occasional check (new social media notifications, for example). However, poorly designed services may run more often or perform syncing operations that you don’t want, affecting battery life and your data usage. If you’ve got a rogue service you may want to try one of the solutions below.

如果后台的应用程序正在运行服务,则情况可能会不同。 精心设计的服务将大部分时间都花在睡觉上,不时醒来以进行偶尔的检查(例如,新的社交媒体通知)。 但是,设计不当的服务可能会更频繁地运行或执行您不想要的同步操作,从而影响电池寿命和数据使用量。 如果您有流氓服务,则可能需要尝试以下解决方案之一。

解决方案 (Solutions)

If you’re sure you want to make this app stop at all costs, you can try these methods.

如果您确定要不惜一切代价使该应用程序停止运行,则可以尝试以下方法。

卸载 (Uninstall)

When an app does something you don’t like, whether running in the background on startup or something else, your first option is to uninstall it. Problem solved! You can remove system apps if you have root, most easily with Titanium Backup, but be careful to remove only carrier bloatware and not critical system apps.

当某个应用执行了您不喜欢的操作时,无论是在启动时在后台运行还是其他操作,您的第一个选择就是将其卸载。 问题解决了! 如果您具有root用户,则可以删除系统应用程序,最简单的方法是使用Titanium Backup ,但要注意仅删除运营商的过时软件,而不要删除关键的系统应用程序。

However, if you want to be able to use that app then this is not an option: keep reading.

但是,如果您希望能够使用该应用程序,那么这不是一个选择:继续阅读。

对开发人员执行Ping操作 (Ping the Developer)

Some of the greatest daemons that come with Android are services that run in background for no reason or when a simple interval check with Android’s AlarmManager would be sufficient. We need to kill them all with fire, and not by ignoring them. Everything that does not involve a fix by the developer is just a hack that will result in other negative side effects. If you contact the developer with your problem, they can fix the app and you can go on using it normally. That’s a win for everyone involved.

Android随附的一些最出色的守护程序是无缘无故地在后台运行的服务,或者仅用Android的AlarmManager进行简单的间隔检查就足够了。 我们需要用火杀死他们,而不是无视他们。 不涉及开发人员修复的所有内容都只是一种骇客行为,将导致其他负面影响。 如果您与开发人员联系遇到问题,他们可以修复该应用,您可以继续正常使用它。 这是每个参与人员的胜利。

手动杀死应用 (Manually Killing Apps)

First, note that many apps will close completely if you Back out of them rather than using the Home button.

首先,请注意,如果您退出其中而不是使用“主页”按钮,则许多应用程序将完全关闭。

If you are running Ice Cream Sandwich or Jelly Bean, you can go into Settings, hit Applications, and manually shut down the app by tabbing over to the running apps. Alternatively you can hit the Recent Applications button and swipe them off the screen to close them. In older versions of Android there may be a built-in Task Manager added by the manufacturer to accomplish the same thing, or you can download a task manager app to do so. For services, look at Settings -> Applications -> Services.

如果您正在运行Ice Cream Sandwich或Jelly Bean,则可以转到“设置”,单击“应用程序”,然后通过跳至正在运行的应用程序来手动关闭该应用程序。 或者,您可以单击“最近使用的应用程序”按钮,然后将其从屏幕上滑动以将其关闭。 在较旧的Android版本中,制造商可能添加了内置的任务管理器来完成相同的任务,或者您可以下载任务管理器应用来执行此操作。 对于服务,请查看Settings -> Applications -> Services

WARNING: Do not use automatic task killers! Automatic task killers run in the background (exactly what you don’t want) and kill apps whenever they start. Most of the time this makes things worse, because apps often consume more resources when they’re starting up compared to when they’re sitting idle. Services that run automatically and are restarted by the system will be killed over and over, wasting your battery. Similarly, apps that receive system events known as Intents (such as network coverage and connectivity changes) will be killed every time they start up to receive an event. Nothing good can come of it.

警告: 不要使用自动任务的杀手! 自动任务杀手程序在后台运行(正是您所不想要的),并在启动时杀死应用程序。 大多数情况下,这会使情况变得更糟,因为与启动时相比,应用程序启动时通常会消耗更多的资源。 自动运行并由系统重新启动的服务将一遍又一遍地被杀死,浪费您的电池。 同样,接收到称为Intent(例如网络覆盖和连接更改)的系统事件的应用程序,每次启动时都会被杀死。 没有任何好处。

A possible exception is automatic tasks that execute only when you, the user, perform a specific action. In essence, they’re just making manual task management easier for you. An app like Tasker or Llama can be used to end activities when you switch apps, for example, ensuring they don’t stay around in the background. Instructions for Llama:

可能的例外情况是自动任务仅在您(用户)执行特定操作时才执行。 本质上,它们只是为您简化了手动任务管理。 例如,当您切换应用程序时,可以使用TaskerLlama之类的应用程序结束活动,以确保它们不会在后台停留。 骆马说明:

Create a new Event. Add the condition called Active App, and choose the status App stopped or in background. Choose the app you want to focus on. Next, add an Action. Select Kill Application (root privileges), then select your app again.

创建一个新Event 。 添加称为Active App的条件,然后选择状态“ App stopped or in background 。 选择您要关注的应用程序。 接下来,添加一个Action 。 选择Kill Application (root privileges) ,然后再次选择您的应用程序。

Now, whenever you leave the app, Llama will kill it.

现在,无论何时离开应用程序,Llama都会将其杀死。

编辑自动启动和意图 (Editing Autostarts and Intents)

As mentioned above, some applications may start when they receive Intents (system events). By using an app like Permissions Denied you can alter which permissions apps can request, which in turn limits which events they can receive. Or you can use an app like Autostarts to edit specifically which Intents will be sent to which apps. For both solutions, you’ll need root access.

如上所述,某些应用程序在收到Intent(系统事件)时可能会启动。 通过使用“ 拒绝权限”之类的应用,您可以更改应用可以请求的权限,从而限制了应用可以接收的事件。 或者,您可以使用“ 自动启动”之类的应用来专门编辑将哪些Intent发送到哪些应用。 对于这两种解决方案,您都需要root访问权限。

Other options:

其他选项:

(Autostarts is free/open-source software, also available from f-droid.)

(自动启动是免费/开源软件,也可以从f-droid获得 。)

WARNING: This can cause apps to stop working or inhibit wanted functionality. Proceed with caution, especially with critical system apps.

警告:这可能会导致应用停止运行或禁止使用所需功能。 谨慎操作,尤其是对于关键系统应用程序。

冻结应用 (Freezing Apps)

You can use an app like Titanium Backup or App Quarantine to complete freeze apps so that they can’t run at all. If you want to use them you have to un-freeze them first.

您可以使用Titanium BackupApp Quarantine之类的应用程序来完成冻结应用程序,以使它们根本无法运行。 如果要使用它们,则必须先解冻它们。

WARNING: Do not do this with critical system apps! Your device may fail to boot.

警告: 不要与关键系统的应用程序做到这一点! 您的设备可能无法启动。

使应用程序进入Hibernate状态 (Put Apps into Hibernation)

Greenify (require Android 4.0+ and ROOT privilege) use a different approach called “Hibernation”, from traditional “Freezing”.

Greenify (需要Android 4.0+和ROOT权限)使用的是与传统的“冻结”不同的方法,即“Hibernate”。

You can safely hibernate any non-system app you do not want to run stealthily (via persistent services, broadcast receivers, alarms and so on), effectively equivalent to “freezing”, while still keeping all its entrances (launcher icon, sharing target, etc) fully functional when you explictly run itm, without the need to un-freeze it first.

您可以安全地Hibernate任何您不想偷偷运行的非系统应用程序(通过持久服务,广播接收器,警报等),实际上等同于“冻结”,同时仍保留其所有入口(启动器图标,共享目标,等等)在您明确运行它时功能全面,而无需先解冻它。

WARNING: Do not hibernate alarm clock apps, instant messaging apps, and other apps whose basic functionality relies on background mechanism (timer, system events, “push”, etc) to work.

警告:请勿使闹钟应用程序,即时消息应用程序和其他其基本功能依赖于后台机制(计时器,系统事件,“推送”等)的应用程序Hibernate。

底线 (The Bottom Line)

Android is designed to take care of app management for you. In all but the most extreme cases, you shouldn’t need to worry about it. When there is a problem, we advise you to go for the simplest solution — uninstalling. All other solutions are hacks around what Android is designed to do. Maybe one day Android will have official support for managing services but, until then, be careful.

Android旨在为您管理应用程序。 除了最极端的情况外,在所有情况下,您都无需担心。 出现问题时,建议您采用最简单的解决方案-卸载。 所有其他解决方案都是围绕Android设计用途的黑客。 也许有一天Android将对管理服务提供官方支持,但在此之前要小心。



Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不对。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/165111/how-can-i-stop-apps-from-running-at-boot-on-android-os/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值