4

I never get the MY_PACKAGE_REPLACED notifications. If I change it to PACKAGE_REPLACED, I do get the expected notifications.

My SDK level is 19 and the devices are 4.0 and above.

Does anyone have insight into this problem?

My receiver definition:

    <receiver android:name="com.jerome.applications.service.PackageReplacedReceiver">
        <intent-filter>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            <data android:scheme="package" />
        </intent-filter>
    </receiver>

My receiver:

public class PackageReplacedReceiver extends BroadcastReceiver {
    private final String kMe = "PackageReplacedReceiver";
    @Override
    public void onReceive(final Context context, final Intent intent) {
        Log.d(kMe, "onReceive context: " + context + " intent: " + intent);

        if ((intent == null) || (context == null)) {
            Log.e(kMe, "onReceive got a null parameter");
        }
        else {
            Log.d(kMe, "onReceive starting to do some stuff”);
        }
    }
}

1 Answers1

4

According to the documentation:

It does not contain any additional data; to receive it, just use an intent filter for this action.

So I think if you pull out the <data> tag from your intent filter it will work.

Douglas Jones
  • 2,522
  • 1
  • 23
  • 27
  • 1
    I am also having the same problem even though i removed the tag. Any solution????? http://stackoverflow.com/questions/39024683/broadcast-receiver-my-package-replaced-never-called – MTurPash Aug 19 '16 at 10:01