Add broadcast receiver for package installation/removal

This commit is contained in:
Ciaran Gultnieks 2012-10-05 18:11:36 +01:00
parent b98f59fb94
commit 1a9f86dc9d
2 changed files with 43 additions and 1 deletions

View File

@ -77,7 +77,17 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="PackageReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_UPGRADED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<service android:name="UpdateService" /> <service android:name="UpdateService" />
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2012 Ciaran Gultnieks, ciaran@ciarang.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.fdroid.fdroid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class PackageReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
((FDroidApp) ctx.getApplicationContext()).invalidateApps();
}
}