如何启动安装android的服务 [英] How to start android service on installation

查看:97
本文介绍了如何启动安装android的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设备管理应用程序,它本质上是在从启动后台服务运行。我想安装完成后立即启动该应用程序。我如何做到这一点?

I have a device management application, which essentially runs as a service in the background from boot. I'd like to start this application immediately after installation. How do I achieve this?

推荐答案

您不能做到这一点 - 没有办法自动启动仅仅是因为它被安装在您的服务

You cannot do this -- there is no way to automatically start your service merely because it was installed.

应用程序必须首先由用户通过某种活动的调用。或者,你将需要通过清单挂接到一些相关的广播意图,这样你就可以得到控制的,当这些事件之一发生,脱掉你的服务的方式。或者,你将需要要求用户重新启动,以便你的 BOOT_COMPLETED 意图过滤器可以得到控制。

The application must first be invoked by the user through some sort of activity. Or, you are going to need to hook into some relevant broadcast Intent via the manifest, so you can get control when one of those events occur and kick off your service that way. Or, you are going to need to ask the user to reboot so your BOOT_COMPLETED Intent filter can get control.

这篇关于如何启动安装android的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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