android.intent.action.PACKAGE_ADDED BroadcastReceiver not receiving theme added intent on JB 4.1
Asked Answered
C

1

9

I am using BroadcastReceiver in my android application, I am running my app on JB 4.1

in manifest I have registered as

<receiver android:name=".ThemeInstalledBroadcastReceiver" android:enabled="true">
    <intent-filter android:priority="100">
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <action android:name="android.intent.action.PACKAGE_REMOVED" />
        <data android:scheme="package" />
    </intent-filter>
</receiver>

when I install any application ThemeInstalledBroadcastReceiver class gets triggered but when I install some theme then ThemeInstalledBroadcastReceiver wont get triggered. But this application works fine when I run it on JB 4.2

My Receiver code goes like this

public class ThemeInstalledBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, final Intent arg1) {
        System.out.println("Mass_TC inside InstalledBroadcastReceiver res " + arg1.getAction().equals(Intent.ACTION_PACKAGE_ADDED) );
        System.out.println("Mass_TC apkid " + arg1.getData().getEncodedSchemeSpecificPart() + " intent : " + arg1);

    }

}

Logs when I install apps

I/System.out(19647): Mass_TC apkid com.example.ttest intent : Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.ttest flg=0x8000010 cmp=com.myrrom.themechooser/.InstalledBroadcastReceiver (has extras) }
I/System.out(19647): Mass_TC deleting apkid  : com.example.ttest x : 0
I/System.out(19647): Mass_TC inside InstalledBroadcastReceiver res true
I/System.out(19647): Mass_TC apkid com.example.test_fa intent : Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.test_fa flg=0x8000010 cmp=com.myrrom.themechooser/.InstalledBroadcastReceiver (has extras) }
I/System.out(19647): Mass_TC deleting apkid  : com.example.test_fa x : 0

but when I install any theme I dont get any logs

Condescendence answered 13/3, 2013 at 5:43 Comment(2)
@DjHacktorReborn I have updated my question. Please find receiver codeCondescendence
What about registering for ACTION_CONFIGURATION_CHANGED will this be triggered? or EXTRA_CHANGED_COMPONENT_NAME_LIST?Anticlinorium
C
0

Some how I figured out the solution.

I added category to my intent filter

<category android:name="com.tmobile.intent.category.THEME_PACKAGE_INSTALL_STATE_CHANGE" />
Condescendence answered 14/3, 2013 at 10:34 Comment(1)
05-24 01:24:24.620: E/AndroidRuntime(569): java.lang.RuntimeException: Unable to instantiate receiver com.marakana.android.devicepolicydemo.NewAppInstalled: java.lang.ClassNotFoundException: com.marakana.android.devicepolicydemo.NewAppInstalled in loader dalvik.system.PathClassLoader[/data/app/com.marakana.android.devicepolicydemo-1.apk]Porosity

© 2022 - 2024 — McMap. All rights reserved.