Search in sources :

Example 1 with AbstractChannelListener

use of com.microsoft.appcenter.channel.AbstractChannelListener in project mobile-center-sdk-android by Microsoft.

the class EventFilter method applyEnabledState.

@Override
protected synchronized void applyEnabledState(boolean enabled) {
    /* Enable filtering logs when this module is enabled. */
    if (enabled) {
        mChannelListener = new AbstractChannelListener() {

            @Override
            public boolean shouldFilter(@NonNull Log log) {
                /* Filter out events. */
                if (log instanceof EventLog) {
                    AppCenterLog.info(LOG_TAG, "Filtered an event out.");
                    return true;
                }
                return false;
            }
        };
        mChannel.addListener(mChannelListener);
    } else /* On applying disabled state, let's make sure we remove listener. */
    if (mChannel != null) {
        mChannel.removeListener(mChannelListener);
    }
}
Also used : AppCenterLog(com.microsoft.appcenter.utils.AppCenterLog) EventLog(com.microsoft.appcenter.analytics.ingestion.models.EventLog) Log(com.microsoft.appcenter.ingestion.models.Log) EventLog(com.microsoft.appcenter.analytics.ingestion.models.EventLog) AbstractChannelListener(com.microsoft.appcenter.channel.AbstractChannelListener)

Aggregations

EventLog (com.microsoft.appcenter.analytics.ingestion.models.EventLog)1 AbstractChannelListener (com.microsoft.appcenter.channel.AbstractChannelListener)1 Log (com.microsoft.appcenter.ingestion.models.Log)1 AppCenterLog (com.microsoft.appcenter.utils.AppCenterLog)1