當前位置: 首頁>>代碼示例>>Java>>正文


Java Utility.logd方法代碼示例

本文整理匯總了Java中com.facebook.internal.Utility.logd方法的典型用法代碼示例。如果您正苦於以下問題:Java Utility.logd方法的具體用法?Java Utility.logd怎麽用?Java Utility.logd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.internal.Utility的用法示例。


在下文中一共展示了Utility.logd方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: flushAndWait

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static void flushAndWait(final FlushReason reason) {

        Set<AccessTokenAppIdPair> keysToFlush;
        synchronized (staticLock) {
            if (requestInFlight) {
                return;
            }
            requestInFlight = true;
            keysToFlush = new HashSet<AccessTokenAppIdPair>(stateMap.keySet());
        }

        accumulatePersistedEvents();

        FlushStatistics flushResults = null;
        try {
            flushResults = buildAndExecuteRequests(reason, keysToFlush);
        } catch (Exception e) {
            Utility.logd(TAG, "Caught unexpected exception while flushing: ", e);
        }

        synchronized (staticLock) {
            requestInFlight = false;
        }

        if (flushResults != null) {
            final Intent intent = new Intent(ACTION_APP_EVENTS_FLUSHED);
            intent.putExtra(APP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED, flushResults.numEvents);
            intent.putExtra(APP_EVENTS_EXTRA_FLUSH_RESULT, flushResults.result);
            LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(intent);
        }
    }
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:32,代碼來源:AppEventsLogger.java

示例2: getStringAsByteArray

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private byte[] getStringAsByteArray(String jsonString) {
    byte[] jsonUtf8 = null;
    try {
        jsonUtf8 = jsonString.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        // shouldn't happen, but just in case:
        Utility.logd("Encoding exception: ", e);
    }
    return jsonUtf8;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:11,代碼來源:AppEventsLogger.java

示例3: saveCookieToken

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private void saveCookieToken(String token) {
    Context context = getStartActivityDelegate().getActivityContext();
    SharedPreferences sharedPreferences = context.getSharedPreferences(
            WEB_VIEW_AUTH_HANDLER_STORE,
            Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putString(WEB_VIEW_AUTH_HANDLER_TOKEN_KEY, token);
    if (!editor.commit()) {
        Utility.logd(TAG, "Could not update saved web view auth handler token.");
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:12,代碼來源:AuthorizationClient.java

示例4: onPageStarted

import com.facebook.internal.Utility; //導入方法依賴的package包/類
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
    Utility.logd(LOG_TAG, "Webview loading URL: " + url);
    super.onPageStarted(view, url, favicon);
    if (!isDetached) {
        spinner.show();
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:9,代碼來源:WebDialog.java

示例5: presentLikeDialog

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private void presentLikeDialog(
        final Activity activity,
        final Fragment fragment,
        final Bundle analyticsParameters) {
    String analyticsEvent = null;

    if (LikeDialog.canShowNativeDialog()) {
        analyticsEvent = AnalyticsEvents.EVENT_LIKE_VIEW_DID_PRESENT_DIALOG;
    } else if (LikeDialog.canShowWebFallback()) {
        analyticsEvent = AnalyticsEvents.EVENT_LIKE_VIEW_DID_PRESENT_FALLBACK;
    } else {
        // We will get here if the user tapped the button when dialogs cannot be shown.
        logAppEventForError("present_dialog", analyticsParameters);
        Utility.logd(TAG, "Cannot show the Like Dialog on this device.");

        // If we got to this point, we should ask the views to check if they should now
        // be disabled.
        broadcastAction(null, ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
    }

    // Using the value of analyticsEvent to see if we can show any version of the dialog.
    // Written this way just to prevent extra lines of code.
    if (analyticsEvent != null) {
        String objectTypeString = (this.objectType != null)
                ? this.objectType.toString()
                : LikeView.ObjectType.UNKNOWN.toString();
        LikeContent likeContent = new LikeContent.Builder()
                .setObjectId(this.objectId)
                .setObjectType(objectTypeString)
                .build();

        if (fragment != null) {
            new LikeDialog(fragment).show(likeContent);
        } else {
            new LikeDialog(activity).show(likeContent);
        }

        saveState(analyticsParameters);

        getAppEventsLogger().logSdkEvent(
                AnalyticsEvents.EVENT_LIKE_VIEW_DID_PRESENT_DIALOG,
                null,
                analyticsParameters);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:46,代碼來源:LikeActionController.java

示例6: shouldOverrideUrlLoading

import com.facebook.internal.Utility; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    Utility.logd(LOG_TAG, "Redirect URL: " + url);
    if (url.startsWith(WebDialog.REDIRECT_URI)) {
        Bundle values = Util.parseUrl(url);

        String error = values.getString("error");
        if (error == null) {
            error = values.getString("error_type");
        }

        String errorMessage = values.getString("error_msg");
        if (errorMessage == null) {
            errorMessage = values.getString("error_description");
        }
        String errorCodeString = values.getString("error_code");
        int errorCode = FacebookRequestError.INVALID_ERROR_CODE;
        if (!Utility.isNullOrEmpty(errorCodeString)) {
            try {
                errorCode = Integer.parseInt(errorCodeString);
            } catch (NumberFormatException ex) {
                errorCode = FacebookRequestError.INVALID_ERROR_CODE;
            }
        }

        if (Utility.isNullOrEmpty(error) && Utility
                .isNullOrEmpty(errorMessage) && errorCode == FacebookRequestError.INVALID_ERROR_CODE) {
            sendSuccessToListener(values);
        } else if (error != null && (error.equals("access_denied") ||
                error.equals("OAuthAccessDeniedException"))) {
            sendCancelToListener();
        } else {
            FacebookRequestError requestError = new FacebookRequestError(errorCode, error, errorMessage);
            sendErrorToListener(new FacebookServiceException(requestError, errorMessage));
        }

        WebDialog.this.dismiss();
        return true;
    } else if (url.startsWith(WebDialog.CANCEL_URI)) {
        sendCancelToListener();
        WebDialog.this.dismiss();
        return true;
    } else if (url.contains(DISPLAY_TOUCH)) {
        return false;
    }
    // launch non-dialog URLs in a full browser
    getContext().startActivity(
            new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    return true;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:52,代碼來源:WebDialog.java

示例7: publishInstallAndWaitForResponse

import com.facebook.internal.Utility; //導入方法依賴的package包/類
static Response publishInstallAndWaitForResponse(
        final Context context,
        final String applicationId,
        final boolean isAutoPublish) {
    try {
        if (context == null || applicationId == null) {
            throw new IllegalArgumentException("Both context and applicationId must be non-null");
        }
        AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
        SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
        String pingKey = applicationId+"ping";
        String jsonKey = applicationId+"json";
        long lastPing = preferences.getLong(pingKey, 0);
        String lastResponseJSON = preferences.getString(jsonKey, null);

        // prevent auto publish from occurring if we have an explicit call.
        if (!isAutoPublish) {
            setShouldAutoPublishInstall(false);
        }

        GraphObject publishParams = GraphObject.Factory.create();
        publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);

        Utility.setAppEventAttributionParameters(publishParams,
                identifiers,
                Utility.getHashedDeviceAndAppID(context, applicationId),
                getLimitEventAndDataUsage(context));
        publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
        publishParams.setProperty("application_package_name", context.getPackageName());

        String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
        Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);

        if (lastPing != 0) {
            GraphObject graphObject = null;
            try {
                if (lastResponseJSON != null) {
                    graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
                }
            }
            catch (JSONException je) {
                // return the default graph object if there is any problem reading the data.
            }
            if (graphObject == null) {
                return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
            } else {
                return new Response(null, null, null, graphObject, true);
            }
        } else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
            throw new FacebookException("No attribution id available to send to server.");
        } else {
            if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
                throw new FacebookException("Install attribution has been disabled on the server.");
            }

            Response publishResponse = publishRequest.executeAndWait();

            // denote success since no error threw from the post.
            SharedPreferences.Editor editor = preferences.edit();
            lastPing = System.currentTimeMillis();
            editor.putLong(pingKey, lastPing);

            // if we got an object response back, cache the string of the JSON.
            if (publishResponse.getGraphObject() != null &&
                publishResponse.getGraphObject().getInnerJSONObject() != null) {
                editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
            }
            editor.commit();

            return publishResponse;
        }
    } catch (Exception e) {
        // if there was an error, fall through to the failure case.
        Utility.logd("Facebook-publish", e);
        return new Response(null, null, new FacebookRequestError(null, e));
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:78,代碼來源:Settings.java


注:本文中的com.facebook.internal.Utility.logd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。