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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With