use of com.facebook.appevents.AppEventsLogger in project facebook-android-sdk by facebook.
the class BoltsMeasurementEventListener method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context);
String eventName = BOLTS_MEASUREMENT_EVENT_PREFIX + intent.getStringExtra(MEASUREMENT_EVENT_NAME_KEY);
Bundle eventArgs = intent.getBundleExtra(MEASUREMENT_EVENT_ARGS_KEY);
Bundle logData = new Bundle();
for (String key : eventArgs.keySet()) {
String safeKey = key.replaceAll("[^0-9a-zA-Z _-]", "-").replaceAll("^[ -]*", "").replaceAll("[ -]*$", "");
logData.putString(safeKey, (String) eventArgs.get(key));
}
appEventsLogger.logEvent(eventName, logData);
}
use of com.facebook.appevents.AppEventsLogger in project facebook-android-sdk by facebook.
the class AutomaticAnalyticsLogger method logActivityTimeSpentEvent.
public static void logActivityTimeSpentEvent(String activityName, long timeSpentInSeconds) {
final Context context = FacebookSdk.getApplicationContext();
final String appId = FacebookSdk.getApplicationId();
Validate.notNull(context, "context");
final FetchedAppSettings settings = FetchedAppSettingsManager.queryAppSettings(appId, false);
if (settings != null && settings.getAutomaticLoggingEnabled() && timeSpentInSeconds > 0) {
AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context);
Bundle params = new Bundle(1);
params.putCharSequence(Constants.AA_TIME_SPENT_SCREEN_PARAMETER_NAME, activityName);
appEventsLogger.logEvent(Constants.AA_TIME_SPENT_EVENT_NAME, timeSpentInSeconds, params);
}
}
use of com.facebook.appevents.AppEventsLogger in project facebook-android-sdk by facebook.
the class DialogPresenter method logDialogActivity.
public static void logDialogActivity(Context context, String eventName, String outcome) {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
Bundle parameters = new Bundle();
parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
logger.logSdkEvent(eventName, null, parameters);
}
use of com.facebook.appevents.AppEventsLogger in project facebook-android-sdk by facebook.
the class LoginMethodHandler method logWebLoginCompleted.
protected void logWebLoginCompleted(String e2e) {
String applicationId = loginClient.getPendingRequest().getApplicationId();
AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(loginClient.getActivity(), applicationId);
Bundle parameters = new Bundle();
parameters.putString(AnalyticsEvents.PARAMETER_WEB_LOGIN_E2E, e2e);
parameters.putLong(AnalyticsEvents.PARAMETER_WEB_LOGIN_SWITCHBACK_TIME, System.currentTimeMillis());
parameters.putString(AnalyticsEvents.PARAMETER_APP_ID, applicationId);
appEventsLogger.logSdkEvent(AnalyticsEvents.EVENT_WEB_LOGIN_COMPLETE, null, parameters);
}
use of com.facebook.appevents.AppEventsLogger in project facebook-android-sdk by facebook.
the class PlacePickerFragment method logAppEvents.
@Override
void logAppEvents(boolean doneButtonClicked) {
AppEventsLogger logger = AppEventsLogger.newLogger(this.getActivity(), AccessToken.getCurrentAccessToken().getToken());
Bundle parameters = new Bundle();
// If Done was clicked, we know this completed successfully. If not, we don't know (caller might have
// dismissed us in response to selection changing, or user might have hit back button). Either way
// we'll log the number of selections.
String outcome = doneButtonClicked ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED : AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN;
parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
parameters.putInt("num_places_picked", (getSelection() != null) ? 1 : 0);
logger.logSdkEvent(AnalyticsEvents.EVENT_PLACE_PICKER_USAGE, null, parameters);
}
Aggregations