com.facebook.internal.Logger Java Examples
The following examples show how to use
com.facebook.internal.Logger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SharedPreferencesTokenCachingStrategy.java From android-skeleton-project with MIT License | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #2
Source File: SharedPreferencesTokenCachingStrategy.java From HypFacebook with BSD 2-Clause "Simplified" License | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #3
Source File: FacebookTimeSpentData.java From Abelana-Android with Apache License 2.0 | 6 votes |
void onSuspend(AppEventsLogger logger, long eventTime) { if (!isAppActive) { Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Suspend for inactive app"); return; } long now = eventTime; long delta = (now - lastResumeTime); if (delta < 0) { Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Clock skew detected"); delta = 0; } millisecondsSpentInSession += delta; lastSuspendTime = now; isAppActive = false; }
Example #4
Source File: SharedPreferencesTokenCachingStrategy.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #5
Source File: SharedPreferencesTokenCachingStrategy.java From Abelana-Android with Apache License 2.0 | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #6
Source File: SharedPreferencesTokenCachingStrategy.java From KlyphMessenger with MIT License | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #7
Source File: SharedPreferencesTokenCachingStrategy.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #8
Source File: GraphResponse.java From kognitivo with Apache License 2.0 | 6 votes |
static List<GraphResponse> createResponsesFromString( String responseString, HttpURLConnection connection, GraphRequestBatch requests ) throws FacebookException, JSONException, IOException { JSONTokener tokener = new JSONTokener(responseString); Object resultObject = tokener.nextValue(); List<GraphResponse> responses = createResponsesFromObject( connection, requests, resultObject); Logger.log( LoggingBehavior.REQUESTS, RESPONSE_LOG_TAG, "Response\n Id: %s\n Size: %d\n Responses:\n%s\n", requests.getId(), responseString.length(), responses); return responses; }
Example #9
Source File: LegacyTokenHelper.java From kognitivo with Apache License 2.0 | 6 votes |
public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log( LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } editor.apply(); }
Example #10
Source File: SharedPreferencesTokenCachingStrategy.java From platform-friends-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #11
Source File: FacebookTimeSpentData.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
void onSuspend(AppEventsLogger logger, long eventTime) { if (!isAppActive) { Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Suspend for inactive app"); return; } long now = eventTime; long delta = (now - lastResumeTime); if (delta < 0) { Logger.log(LoggingBehavior.APP_EVENTS, TAG, "Clock skew detected"); delta = 0; } millisecondsSpentInSession += delta; lastSuspendTime = now; isAppActive = false; }
Example #12
Source File: SharedPreferencesTokenCachingStrategy.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #13
Source File: SharedPreferencesTokenCachingStrategy.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #14
Source File: SharedPreferencesTokenCachingStrategy.java From Klyph with MIT License | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #15
Source File: SharedPreferencesTokenCachingStrategy.java From Klyph with MIT License | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #16
Source File: SharedPreferencesTokenCachingStrategy.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #17
Source File: SharedPreferencesTokenCachingStrategy.java From FacebookImageShareIntent with MIT License | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #18
Source File: SharedPreferencesTokenCachingStrategy.java From barterli_android with Apache License 2.0 | 6 votes |
/** * Returns a Bundle that contains the information stored in this cache * * @return A Bundle with the information contained in this cache */ public Bundle load() { Bundle settings = new Bundle(); Map<String, ?> allCachedEntries = cache.getAll(); for (String key : allCachedEntries.keySet()) { try { deserializeKey(key, settings); } catch (JSONException e) { // Error in the cache. So consider it corrupted and return null Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error reading cached value for key: '" + key + "' -- " + e); return null; } } return settings; }
Example #19
Source File: SharedPreferencesTokenCachingStrategy.java From barterli_android with Apache License 2.0 | 6 votes |
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
Example #20
Source File: AppEventsLogger.java From Abelana-Android with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private static void restoreAppSessionInformation(Context context) { ObjectInputStream ois = null; synchronized (staticLock) { if (!isLoaded) { try { ois = new ObjectInputStream( context.openFileInput(PERSISTED_SESSION_INFO_FILENAME)); appSessionInfoMap = (HashMap<AccessTokenAppIdPair, FacebookTimeSpentData>) ois.readObject(); Logger.log( LoggingBehavior.APP_EVENTS, "AppEvents", "App session info loaded"); } catch (FileNotFoundException fex) { } catch (Exception e) { Log.d(TAG, "Got unexpected exception: " + e.toString()); } finally { Utility.closeQuietly(ois); context.deleteFile(PERSISTED_SESSION_INFO_FILENAME); if (appSessionInfoMap == null) { appSessionInfoMap = new HashMap<AccessTokenAppIdPair, FacebookTimeSpentData>(); } // Regardless of the outcome of the load, the session information cache // is always deleted. Therefore, always treat the session information cache // as loaded isLoaded = true; hasChanges = false; } } } }
Example #21
Source File: PlacePickerFragment.java From FacebookImageShareIntent with MIT License | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }
Example #22
Source File: PlacePickerFragment.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }
Example #23
Source File: InsightsLogger.java From FacebookImageShareIntent with MIT License | 5 votes |
/** * Deprecated. Please use {@link AppEventsLogger} instead. */ public void 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(); }
Example #24
Source File: InsightsLogger.java From KlyphMessenger with MIT License | 5 votes |
/** * Deprecated. Please use {@link AppEventsLogger} instead. */ public void 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(); }
Example #25
Source File: PlacePickerFragment.java From android-skeleton-project with MIT License | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }
Example #26
Source File: PlacePickerFragment.java From KlyphMessenger with MIT License | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }
Example #27
Source File: InsightsLogger.java From android-skeleton-project with MIT License | 5 votes |
/** * Deprecated. Please use {@link AppEventsLogger} instead. */ public void 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(); }
Example #28
Source File: ProfilePictureView.java From HypFacebook with BSD 2-Clause "Simplified" License | 5 votes |
private void sendImageRequest(boolean allowCachedResponse) { try { ImageRequest.Builder requestBuilder = new ImageRequest.Builder( getContext(), ImageRequest.getProfilePictureUrl(profileId, queryWidth, queryHeight)); ImageRequest request = requestBuilder.setAllowCachedRedirects(allowCachedResponse) .setCallerTag(this) .setCallback( new ImageRequest.Callback() { @Override public void onCompleted(ImageResponse response) { processResponse(response); } }) .build(); // Make sure to cancel the old request before sending the new one to prevent // accidental cancellation of the new request. This could happen if the URL and // caller tag stayed the same. if (lastRequest != null) { ImageDownloader.cancelRequest(lastRequest); } lastRequest = request; ImageDownloader.downloadAsync(request); } catch (MalformedURLException e) { Logger.log(LoggingBehavior.REQUESTS, Log.ERROR, TAG, e.toString()); } }
Example #29
Source File: PlacePickerFragment.java From barterli_android with Apache License 2.0 | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }
Example #30
Source File: PlacePickerFragment.java From Abelana-Android with Apache License 2.0 | 5 votes |
private void onSearchTextTimerTriggered() { if (hasSearchTextChangedSinceLastQuery) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { FacebookException error = null; try { loadData(true); } catch (FacebookException fe) { error = fe; } catch (Exception e) { error = new FacebookException(e); } finally { if (error != null) { OnErrorListener onErrorListener = getOnErrorListener(); if (onErrorListener != null) { onErrorListener.onError(PlacePickerFragment.this, error); } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error loading data : %s", error); } } } } }); } else { // Nothing has changed in 2 seconds. Invalidate and forget about this timer. // Next time the user types, we will fire a query immediately again. searchTextTimer.cancel(); searchTextTimer = null; } }