All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.analytics.NetworkEventController Maven / Gradle / Ivy

The newest version!
package com.eg.agent.android.analytics;

import com.eg.agent.android.harvest.HttpData;
import com.eg.agent.android.logging.EGAgentLog;
import com.eg.agent.android.logging.EGAgentLogManager;
import com.eg.agent.android.Features;

public class NetworkEventController {
	 private static final EGAgentLog log = EGAgentLogManager.getAgentLog();
	public static void createHttpErrorEvent(HttpData httpTransaction) {
	    if (Features.featureEnabled(Features.NetworkErrorRequests))
	      if (!BaseController.getInstance().addEvent(NetworkRequestErrorEvent.createHttpErrorEvent(httpTransaction))) {
	        log.error("Failed to add MobileRequestError");
	      } else {
	        log.verbose(String.valueOf(EventCategory.RequestError.toString()) + " added to event store for request: " + httpTransaction.getUrl());
	      }  
	  }
	  
	  public static void createNetworkFailureEvent(HttpData httpTransaction) {
	    if (Features.featureEnabled(Features.NetworkErrorRequests))
	      if (!BaseController.getInstance().addEvent(NetworkRequestErrorEvent.createNetworkFailureEvent(httpTransaction))) {
	        log.error("Failed to add MobileRequestError");
	      } else {
	        log.verbose(String.valueOf(EventCategory.RequestError.toString()) + " added to event store for request: " + httpTransaction.getUrl());
	      }  
	  }
	  
	  public static void createNetworkRequestEvent(HttpData txn) {
	    if (Features.featureEnabled(Features.NetworkRequests))
	      if (!BaseController.getInstance().addEvent(NetworkRequestEvent.createNetworkEvent(txn))) {
	        log.error("Failed to add MobileRequest");
	      } else {
	        log.verbose(String.valueOf(EventCategory.NetworkRequest.toString()) + " added to event store for request: " + txn.getUrl());
	      }  
	  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy