If you think the Android project BagOfPix listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
* Copyright 2010-present Facebook.//fromwww.java2s.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package com.facebook;
import android.content.Context;
import android.os.Bundle;
import com.facebook.internal.Logger;
import java.math.BigDecimal;
import java.util.Currency;
/**
* This class is deprecated. Please use {@link AppEventsLogger} instead.
*/
@Deprecated
publicclass InsightsLogger {
privatestaticfinal String EVENT_PARAMETER_PIXEL_ID = "fb_offsite_pixel_id";
privatestaticfinal String EVENT_PARAMETER_PIXEL_VALUE = "fb_offsite_pixel_value";
privatestaticfinal String EVENT_NAME_LOG_CONVERSION_PIXEL = "fb_log_offsite_pixel";
private AppEventsLogger appEventsLogger;
private InsightsLogger(Context context, String applicationId, Session session) {
appEventsLogger = AppEventsLogger.newLogger(context, applicationId, session);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicstatic InsightsLogger newLogger(Context context, String clientToken) {
returnnew InsightsLogger(context, null, null);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicstatic InsightsLogger newLogger(Context context, String clientToken, String applicationId) {
returnnew InsightsLogger(context, applicationId, null);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicstatic InsightsLogger newLogger(Context context, String clientToken, String applicationId, Session session) {
returnnew InsightsLogger(context, applicationId, session);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicvoid logPurchase(BigDecimal purchaseAmount, Currency currency) {
logPurchase(purchaseAmount, currency, null);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicvoid logPurchase(BigDecimal purchaseAmount, Currency currency, Bundle parameters) {
appEventsLogger.logPurchase(purchaseAmount, currency, parameters);
}
/**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/publicvoid logConversionPixel(String pixelId, double valueOfPixel) {
if (pixelId == null) {
Logger.log(LoggingBehavior.DEVELOPER_ERRORS, "Insights", "pixelID cannot be null");
return;
}
Bundle parameters = new Bundle();
parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId);
parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel);
appEventsLogger.logEvent(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters);
AppEventsLogger.eagerFlush();
}
}