如何自动启动服务的Andr​​oid? [英] How to auto start service in android?

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

问题描述

目前Android应用程序,它总是伸出活动,入场的onCreate。如此看来,用户必须选择应用程序,然后单击以luanch它。(如果是错了,请告诉我。对不起)

At Android application, it always extends Activity and the entry is onCreate. So it seems that user has to select application and click to luanch it.(if it is wrong,please advise me. sorry)

那么,如何implent无需用户点击来启动应用程序在后台运行的服务?

So, how to implent a service running on background without user clicking to start application?

推荐答案

使用一个IntentReceiver接收BOOT_COMPLETED_ACTION。

Use an IntentReceiver to receive the BOOT_COMPLETED_ACTION.

然后在IntentReceiver,你可以调用startService()。

Then in the IntentReceiver, you can call startService().

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

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