views:

59

answers:

1

I want to set up a BroadcastReceiver to handle PACKAGE_REPLACED, but I only want to be notified when my package is replaced. It works fine if I specify a data tag with scheme="package" but then I get notified when any application is reinstalled or upgraded. I can't figure out how I'm supposed to specify the package name which is in the scheme specific part -- that is, when my BroadcastReceiver gets the intent in onRecieve(), if I do intent.getData().getSchemeSpecificPart(), that's the package name, but is there any way I can filter for only that in my intent-filter?

A: 

Easiest would be to accept any broadcast intents with the package scheme as you say, but do the filtering based on the Intent extras that are sent with the PACKAGE_* actions.

If the package name in the Intent doesn't match yours, just ignore it.

Christopher