安装应用程序后无需启动应用程序本身即可启动Android服务 [英] Android start service after installing app without starting the App itself

查看:64
本文介绍了安装应用程序后无需启动应用程序本身即可启动Android服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最近的一次采访中,采访询问是否可以在仅安装应用程序后不启动应用程序的情况下启动服务?

In an interview recently, the interview asked if it is possible to start service after just installing the app without starting it?

有可能吗?

推荐答案

这不可能.

应用程序以停止状态"安装,与用户在设置"中的应用程序页面上按强制停止"后所处的状态相同.在停止状态"下,它需要显式的 Intent 来使该应用程序的任何代码运行.在大多数应用中,这意味着用户点击该应用的主屏幕启动器图标.

Apps are installed in a "stopped state", the same state that they are in after the user presses "Force Stop" on the app's page in Settings. While in that "stopped state", it takes an explicit Intent to cause any of that app's code to run. In most apps, that means that the user taps the home screen launcher icon for the app.

这篇关于安装应用程序后无需启动应用程序本身即可启动Android服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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