Fixed real time strategy
@@ -4,6 +4,7 @@ import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
+
import com.mercadopago.tracking.listeners.TracksListener;
import com.mercadopago.tracking.model.ActionEvent;
import com.mercadopago.tracking.model.AppInformation;
@@ -130,7 +131,6 @@ public class MPTracker {
* @param deviceInfo Info about the device that is using the app
* @param event Event to track
* @param context Application context
- * @param trackingStrategy
*/
public void trackEvent(String publicKey, AppInformation appInformation, DeviceInfo deviceInfo, Event event, Context context, String trackingStrategy) {
@@ -140,7 +140,6 @@ public class MPTracker {
mContext = context;
initializeDatabase();
- database.persist(event);
setTrackingStrategy(context, event, trackingStrategy);
@@ -151,6 +150,10 @@ public class MPTracker {
this.trackingStrategy.trackEvent(event, context);
}
+ if (!isRealTimeStrategy(trackingStrategy)) {
+ database.persist(event);
+ }
+
if (event.getType().equals(Event.TYPE_ACTION)) {
ActionEvent actionEvent = (ActionEvent) event;
Map<String, String> eventMap = createEventMap(actionEvent);
@@ -259,6 +262,10 @@ public class MPTracker {
return strategy != null && strategy.equals(TrackingUtil.BATCH_STRATEGY);
}
+ private boolean isRealTimeStrategy(String strategy) {
+ return strategy == null;
+ }
+
private boolean isErrorScreen(String name) {
return name.equals(TrackingUtil.SCREEN_NAME_ERROR);
}
