开发者

How to auto start service in android?

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开发者_开发百科)

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


Use an IntentReceiver to receive the BOOT_COMPLETED_ACTION.

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


And when I install the applications apk on the emulator/device then the service will start running

That is not possible. Android does not allow applications of any form to run immediately upon installation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜