Can you guide me to check if any other android application installed then push Notification “Example” app installed

Admin

Administrator
Thành viên BQT
#2
That was possible before Android 8.0 (API level 26)
Mã:
<receiver android:name=".apps.AppListener">
    <intent-filter android:priority="100">
         <action android:name="android.intent.action.PACKAGE_INSTALL"/>
         <action android:name="android.intent.action.PACKAGE_ADDED"/> 
         <action android:name="android.intent.action.PACKAGE_REMOVED"/>
         <data android:scheme="package"/>
    </intent-filter>
</receiver>
After android 8.0 from docs:
Apps that target Android 8.0 or higher can no longer register broadcast receivers for implicit broadcasts in their manifest. An implicit broadcast is a broadcast that does not target that app specifically. For example, ACTION_PACKAGE_REPLACED is an implicit broadcast, since it is sent to all registered listeners, letting them know that some package on the device was replaced. However, ACTION_MY_PACKAGE_REPLACED is not an implicit broadcast, since it is sent only to the app whose package was replaced, no matter how many other apps have registered listeners for that broadcast.
Workaround by CommonsWare, sample app
You can also use polling, setting up a JobScheduler job to check every so often, asking PackageManager for what has changed in the roster of installed apps via getChangedPackages():
 
Top