use of com.facebook.internal.FetchedAppSettings in project facebook-android-sdk by facebook.
the class FacebookRequestError method getErrorClassification.
static synchronized FacebookRequestErrorClassification getErrorClassification() {
FacebookRequestErrorClassification errorClassification;
FetchedAppSettings appSettings = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
if (appSettings == null) {
return FacebookRequestErrorClassification.getDefaultErrorClassification();
}
return appSettings.getErrorClassification();
}
use of com.facebook.internal.FetchedAppSettings in project facebook-android-sdk by facebook.
the class AppEventQueue method buildRequestForSession.
private static GraphRequest buildRequestForSession(final AccessTokenAppIdPair accessTokenAppId, final SessionEventsState appEvents, final boolean limitEventUsage, final FlushStatistics flushState) {
String applicationId = accessTokenAppId.getApplicationId();
FetchedAppSettings fetchedAppSettings = FetchedAppSettingsManager.queryAppSettings(applicationId, false);
final GraphRequest postRequest = GraphRequest.newPostRequest(null, String.format("%s/activities", applicationId), null, null);
Bundle requestParameters = postRequest.getParameters();
if (requestParameters == null) {
requestParameters = new Bundle();
}
requestParameters.putString("access_token", accessTokenAppId.getAccessTokenString());
String pushNotificationsRegistrationId = AppEventsLogger.getPushNotificationsRegistrationId();
if (pushNotificationsRegistrationId != null) {
requestParameters.putString("device_token", pushNotificationsRegistrationId);
}
postRequest.setParameters(requestParameters);
boolean supportsImplicitLogging = false;
if (fetchedAppSettings != null) {
supportsImplicitLogging = fetchedAppSettings.supportsImplicitLogging();
}
int numEvents = appEvents.populateRequest(postRequest, FacebookSdk.getApplicationContext(), supportsImplicitLogging, limitEventUsage);
if (numEvents == 0) {
return null;
}
flushState.numEvents += numEvents;
postRequest.setCallback(new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
handleResponse(accessTokenAppId, postRequest, response, appEvents, flushState);
}
});
return postRequest;
}
use of com.facebook.internal.FetchedAppSettings 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.internal.FetchedAppSettings in project facebook-android-sdk by facebook.
the class CustomTabLoginMethodHandler method isCustomTabsEnabled.
private boolean isCustomTabsEnabled() {
final String appId = Utility.getMetadataApplicationId(loginClient.getActivity());
final FetchedAppSettings settings = FetchedAppSettingsManager.getAppSettingsWithoutQuery(appId);
return settings != null && settings.getCustomTabsEnabled();
}
use of com.facebook.internal.FetchedAppSettings in project facebook-android-sdk by facebook.
the class CustomTabLoginMethodHandlerTest method mockCustomTabsAllowed.
private void mockCustomTabsAllowed(final boolean allowed) {
final FetchedAppSettings settings = mock(FetchedAppSettings.class);
when(settings.getCustomTabsEnabled()).thenReturn(allowed);
mockStatic(FetchedAppSettingsManager.class);
when(FetchedAppSettingsManager.getAppSettingsWithoutQuery(anyString())).thenReturn(settings);
}
Aggregations