-2

I want to perform some action in my app when a new other application is installed in the device.

Is there any way I can do that? TIA

1 Answers1

2

You should register for a broadcast when a package is added/removed, where android system broadcast a message to the all the registered apps.

so in your manifest add a broadcast receiver.

<receiver android:name=".AppListener">
            <intent-filter android:priority="{highInteger}">
                <action android:name="android.intent.action.PACKAGE_ADDED"/>
                <action android:name="android.intent.action.PACKAGE_REMOVED"/>
                <data android:scheme="package"/>
            </intent-filter>
        </receiver>

Where AppListener is your java class where in onReceive() you can perform the desired operation.

Comment for any further doubts.

Manikanta
  • 3,421
  • 4
  • 30
  • 51