sPFFramework/src/main/java/it/polimi/spf/framework/local/SPFService.java
@Override
    public IBinder onBind(Intent intent) {
        String action = intent.getAction();
        Log.d(TAG, "External app bound with action " + intent.getAction());

        if (SPFInfo.ACTION_PROXIMITY_SERVER.equalsIgnoreCase(action)) {
            SPF.get().connect();
            // Request the binder that offers access to proximity
            // functionalities
            if (mServerBinder == null) {
                mServerBinder = new SPFProximityServiceImpl();
            }
            return mServerBinder;

        } else if (SPFInfo.ACTION_PROFILE.equals(action)) {
            // Requests the binder that offers the access to the local profile
            if (mProfileBinder == null) {
                mProfileBinder = new SPFProfileServiceImpl(this);
            }
            return mProfileBinder;

        } else if (SPFInfo.ACTION_SERVICE.equalsIgnoreCase(action)) {
            // Request the binder to manage local services
            if (mLocalServiceBinder == null) {
                mLocalServiceBinder = new SPFServiceManagerImpl();
            }
            return mLocalServiceBinder;

        } else if (SPFInfo.ACTION_NOTIFICATION.equalsIgnoreCase(action)) {
            // request the binder to access notification services
            if (mNotificationBinder == null) {
                mNotificationBinder = new SPFNotificationServiceImpl(this);
            }
            return mNotificationBinder;
        } else if (SPFInfo.ACTION_SECURITY.equals(action)) {
            // request the binder to access security services
            if (mSecurityBinder == null) {
                mSecurityBinder = new SPFSecurityServiceImpl(this);
            }
            return mSecurityBinder;
        }

        Log.d(TAG, "Unrecognized action: " + action);
        return null;
    }
@Override
    public IBinder onBind(Intent intent) {
        String action = intent.getAction();
        Log.d(TAG, "External app bound with action " + intent.getAction());

        if (SPFInfo.ACTION_PROXIMITY_SERVER.equalsIgnoreCase(action)) {
            SPF.get().connect();
            // Request the binder that offers access to proximity
            // functionalities
            if (mServerBinder == null) {
                mServerBinder = new SPFProximityServiceImpl();
            }
            return mServerBinder;

        } else if (SPFInfo.ACTION_PROFILE.equals(action)) {
            // Requests the binder that offers the access to the local profile
            if (mProfileBinder == null) {
                mProfileBinder = new SPFProfileServiceImpl(this);
            }
            return mProfileBinder;

        } else if (SPFInfo.ACTION_SERVICE.equalsIgnoreCase(action)) {
            // Request the binder to manage local services
            if (mLocalServiceBinder == null) {
                mLocalServiceBinder = new SPFServiceManagerImpl();
            }
            return mLocalServiceBinder;

        } else if (SPFInfo.ACTION_NOTIFICATION.equalsIgnoreCase(action)) {
            // request the binder to access notification services
            if (mNotificationBinder == null) {
                mNotificationBinder = new SPFNotificationServiceImpl(this);
            }
            return mNotificationBinder;
        } else if (SPFInfo.ACTION_SECURITY.equals(action)) {
            // request the binder to access security services
            if (mSecurityBinder == null) {
                mSecurityBinder = new SPFSecurityServiceImpl(this);
            }
            return mSecurityBinder;
        }

        Log.d(TAG, "Unrecognized action: " + action);
        return null;
    }
/*
(non-Javadoc)

@see android.app.Service#onBind(android.content.Intent)