简体   繁体   中英

Start service on installation of app without any activity

Is it possible to directly start a service without any activity. by making a service a launcher. I want to start service repeatedly at the interval of 2 min. can I use alarm. At present I have an activity that starts an alarm using this manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), duration, loggerIntent); that starts service at every 2 min. How can I remove this activity.

There is no straightforward way to start a service on just installing the app, without user opening it first time. If you read the answers on the above two questions, you will get the gist.
1) How to start a Service when .apk is Installed for the first time

2) How to start android service on installation

Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM