sPFFramework/src/main/java/it/polimi/spf/framework/services/PackageChangeReceiver.java
@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		SPFSecurityMonitor securityMonitor = SPF.get().getSecurityMonitor();
		String packageIdentifier = intent.getData().getSchemeSpecificPart();

		if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
			// TODO Maybe we can check if the app wants to use SPF?
		} else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
			if(intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)){
				Log.d(TAG, "App " + packageIdentifier + " is being updated - do not remove");
				return;
			}
			
			if (securityMonitor.isAppRegistered(packageIdentifier)) {
				securityMonitor.unregisterApplication(packageIdentifier);
				Log.d(TAG, "App " + packageIdentifier + " uninstalled from SPF");
			} else {
				Log.d(TAG, "App " + packageIdentifier + " was not installed in SPF");
			}
		}
	}
@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		SPFSecurityMonitor securityMonitor = SPF.get().getSecurityMonitor();
		String packageIdentifier = intent.getData().getSchemeSpecificPart();

		if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
			// TODO Maybe we can check if the app wants to use SPF?
		} else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
			if(intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)){
				Log.d(TAG, "App " + packageIdentifier + " is being updated - do not remove");
				return;
			}
			
			if (securityMonitor.isAppRegistered(packageIdentifier)) {
				securityMonitor.unregisterApplication(packageIdentifier);
				Log.d(TAG, "App " + packageIdentifier + " uninstalled from SPF");
			} else {
				Log.d(TAG, "App " + packageIdentifier + " was not installed in SPF");
			}
		}
	}
@ Override public void onReceive ( Context context , Intent intent ) { String action = intent . getAction ( ) ; SPFSecurityMonitor securityMonitor = SPF . get ( ) . getSecurityMonitor ( ) ; String packageIdentifier = intent . getData ( ) . getSchemeSpecificPart ( ) ; if ( action . equals ( Intent . ACTION_PACKAGE_ADDED ) ) { // TODO Maybe we can check if the app wants to use SPF? } else if ( action . equals ( Intent . ACTION_PACKAGE_REMOVED ) ) { if ( intent . getBooleanExtra ( Intent . EXTRA_REPLACING , false ) ) { Log . d ( TAG , "App " + packageIdentifier + " is being updated - do not remove" ) ; return ; } if ( securityMonitor . isAppRegistered ( packageIdentifier ) ) { securityMonitor . unregisterApplication ( packageIdentifier ) ; Log . d ( TAG , "App " + packageIdentifier + " uninstalled from SPF" ) ; } else { Log . d ( TAG , "App " + packageIdentifier + " was not installed in SPF" ) ; } } }
/*
(non-Javadoc)

@see android.content.BroadcastReceiver#onReceive(android.content.Context,
android.content.Intent)
/ * ( non - Javadoc )