@Override protected void processError(FacebookRequestError error) { int errorCode = error.getErrorCode(); if (errorCode == ERROR_CODE_OBJECT_ALREADY_LIKED) { // This isn't an error for us. Client was just out of sync with server // This will prevent us from showing the dialog for this. // However, there is no unliketoken. So a subsequent unlike WILL show the dialog this.error = null; } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error liking object '%s' with type '%s' : %s", objectId, objectType, error); logAppEventForError("publish_like", error); } }
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; }
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; }
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; }
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(); }
/** * 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; }
/** * 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"); } }
private void processResponse(ImageResponse response) { // First check if the response is for the right request. We may have: // 1. Sent a new request, thus super-ceding this one. // 2. Detached this view, in which case the response should be discarded. if (response.getRequest() == lastRequest) { lastRequest = null; Bitmap responseImage = response.getBitmap(); Exception error = response.getError(); if (error != null) { OnErrorListener listener = onErrorListener; if (listener != null) { listener.onError(new FacebookException( "Error in downloading profile picture for profileId: " + getProfileId(), error)); } else { Logger.log(LoggingBehavior.REQUESTS, Log.ERROR, TAG, error.toString()); } } else if (responseImage != null) { setImageBitmap(responseImage); if (response.isCachedRedirect()) { sendImageRequest(false); } } } }
/** * 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; } } editor.apply(); }
static void saveAppSessionInformation(Context context) { ObjectOutputStream oos = null; synchronized (staticLock) { if (hasChanges) { try { oos = new ObjectOutputStream( new BufferedOutputStream( context.openFileOutput( PERSISTED_SESSION_INFO_FILENAME, Context.MODE_PRIVATE) ) ); oos.writeObject(appSessionInfoMap); hasChanges = false; Logger.log(LoggingBehavior.APP_EVENTS, "AppEvents", "App session info saved"); } catch (Exception e) { Log.d(TAG, "Got unexpected exception: " + e.toString()); } finally { Utility.closeQuietly(oos); } } } }
@Override protected void processError(FacebookRequestError error) { // If this object Id is for a Page, an error will be received for this request // We will then rely on the other request to come through. if (error.getErrorMessage().contains("og_object")) { this.error = null; } else { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error getting the FB id for object '%s' with type '%s' : %s", objectId, objectType, error); } }
@Override protected void processError(FacebookRequestError error) { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error getting the FB id for object '%s' with type '%s' : %s", objectId, objectType, error); }
@Override protected void processError(FacebookRequestError error) { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error unliking object with unlike token '%s' : %s", unlikeToken, error); logAppEventForError("publish_unlike", error); }
@Override protected void processError(FacebookRequestError error) { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error fetching like status for page id '%s': %s", this.pageId, error); logAppEventForError("get_page_like", error); }
@Override protected void processError(FacebookRequestError error) { Logger.log(LoggingBehavior.REQUESTS, TAG, "Error fetching like status for object '%s' with type '%s' : %s", this.objectId, this.objectType, error); logAppEventForError("get_og_object_like", error); }