How to run an app on startup in background? For example glasswire, kaspersky run in startup, as well as show in top In notification bar tray. I want to run Gom audio in background when start up & show up in tray automatically.
Probably the best way to auto-launch an application in the background (without UI explicitly) is using the
am startservice -n command together with automation with applications such as Tasker and the like capable of registering a
Depending on the nature of the application (which may require root), you can set up this in Tasker:
Note: The application needs to have a defined service(s) declared in manifest.xml file
You can use Tasker (7 day trial available) to accomplish this:
Objective: Auto start a defined application in background after boot
Profile (or Trigger)
Create a Profile which allows triggering of the Task after boot:
- Go to Profiles Tab and click "+"
- Event → System → Device Boot
- Tap back to exit from this window
You will notice as soon as you exit, you will be prompted to link this Profile to a Task;
- Scroll all the way up the Task list select "New Task + "
- You can name this Task AutoStart or anything.
- Click "+" to add new Action
Code → Run shell → enter command
start the activity(it can be the main activity of the app or certain parts e.g monitoring data in my example:
Using NetMonitor Mini (
info.kfsoft.android.TrafficIndicatorPro) I may decide to auto start in background the data monitoring service, so in the command box I write:
am startservice -n info.kfsoft.android.TrafficIndicatorPro/.TrafficMonitorServiceto start at boot.
If it needs needs root, remember to check the box accordingly.
Press back the way all back until you exit Tasker (your profile is now saved and is ready for execution)
Extras: Give Tasker more priority (allow auto-start for Tasker, exclude from battery optimisations, task killers etc)
Explanation: Soon after boot, the action starts the application in background)