Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why MY_PACKAGE_REPLACED Android action is ignored by the content scheme

I have a intent-filter declaration in the manifest for a broadcast.

       <intent-filter>
            <action android:name="android.intent.action.TIME_SET"/>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
            <data android:scheme="content"/>
        </intent-filter>

The problem is when I remove the <data android:scheme="content"/> the MY_PACKAGE_REPLACED action is received otherwise no.

What does the data tag in this case? Can't really understand from the documentation.

like image 901
X-HuMan Avatar asked Jan 06 '23 10:01

X-HuMan


1 Answers

The <data> element says "there must be a Uri on the Intent, and it must match the rules provided in the <data> elements of the <intent-filter>". In your particular case, the rule is "the Uri must exist and it must have a content scheme".

Since none of those three broadcasts uses a content Uri, delete the <data> element.

like image 184
CommonsWare Avatar answered Jan 07 '23 23:01

CommonsWare