开发者

How to auto start service in android?

开发者 https://www.devze.com 2023-01-21 04:38 出处:网络
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开发者_开发百

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

精彩评论

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