Broadcast receiver not receiving MY_PACKAGE_REPLACED intents

As per the Android O developer preview, we can no longer use the PACKAGE_REPLACED intent for use with a receiver declared inside a manifest.

An alternative is MY_PACKAGE_REPLACED. But this intent doesn't seem to work when I update the app via android studio after changing the code. Whereas the older, broader intentions have always worked properly.

    <receiver
        android:name=".Receivers.BootEventReceiver"
        android:exported="true"
        android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
        </intent-filter>
    </receiver>

      

Let's say the receiver itself just prints a log message to onReceive ().

Googling suggested that this appears to be an android issue. But I really couldn't figure out how to solve this.

Can someone point me in the right direction

+3


source to share


1 answer


Instead of having one receiver with two intent filters, I decided to make a separate receiver with the MY_PACKAGE_REPLACED intent filter.



The receiver started working again. Hope this helps anyone interested

+1


source







All Articles