How can I run code in the background when a new app is installed?

92 Views Asked by At

I'd like to run code in my app when any new app is installed. Is there a way to do this?
I'm open to methods that require the use of a foreground service or elevated app permissions.

1

There are 1 best solutions below

0
Next Day Software Solution Pvt On

You need make foreground service that and also make broadcastReceiver this received

 <action android:name="android.intent.action.PACKAGE_INSTALL"/>
 <action android:name="android.intent.action.PACKAGE_ADDED"/>  
 <action android:name="android.intent.action.PACKAGE_REMOVED"/>

This action broadcastReceiver need to register in service