Nativ Nativ - 5 months ago 79
Android Question

How to test PACKAGE_REPLACED event

I'm trying to catch .PACKAGE_REPLACED event in order to see if my code runs good, however I can't stimulate it. I tried using adb shell command:

am broadcast -a android.intent.action.PACKAGE_REPLACED -n com.draoid/.com.draoid.installationtracking.nnn.InstallTracking --es "package_replaced" "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"

but nothing happens


That Intent is protected and can only be sent by the system itself. However, if you reinstall your app using

adb install -r yourapp.apk

This should generate the PACKAGE_REPLACED broadcast.