I'm asking you this question because there's a blockage during Android development.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_ADDED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_INSTALL" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED" />
<receiver
android:name=".BCReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package"/>
</intent-filter>
</receiver>
I'm testing to add receiver and delete app installation as above It works well when it comes to booting, but the app installation update doesn't work I can't find the answer even if I look everywhere, so I leave a question like this. The Android version is 5.1.1 (SDK 22) and upon receipt of the broadcast receiver's onReceive, If you leave a log, events such as shutdown boot will occur, but the rest will not occur. I need your help.
android
For no particular reason, set the enabled, exported property of the broadcast receiver to true. If exported is false, you will not be able to receive messages from outside the app. Please change the two settings to true and test them.
For package installation, deletion, and update, it is helpful to look at the launch source code in AOSP. Please refer to the link below.
© 2024 OneMinuteCode. All rights reserved.