com.facebook.internal.Utility.logd()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.facebook.internal.Utility.logd()方法的一些代码示例,展示了Utility.logd()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utility.logd()方法的具体详情如下:
包路径:com.facebook.internal.Utility
类名称:Utility
方法名:logd

Utility.logd介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

@Override
public void onServiceDisconnected(ComponentName name) {
  inAppBillingService = null;
  Utility.logd(TAG, "In-app billing service disconnected");
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
  public void onComplete(
      LikeActionController likeActionController,
      FacebookException error) {
    if (error == null) {
      likeActionController.onActivityResult(
          requestCode,
          resultCode,
          data);
    } else {
      Utility.logd(TAG, error);
    }
  }
});

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * Returns the Graph API version to use when making Graph requests. This defaults to the latest
 * Graph API version at the time when the Facebook SDK is shipped.
 *
 * @return the Graph API version to use.
 */
public static String getGraphApiVersion() {
  Utility.logd(TAG, String.format("getGraphApiVersion: %s", graphApiVersion));
  return graphApiVersion;
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
protected void onPostExecute(List<GraphResponse> result) {
  super.onPostExecute(result);
  if (exception != null) {
    Utility.logd(TAG, String.format(
        "onPostExecute: exception encountered during request: %s",
        exception.getMessage()));
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private static void initTouchTargetHelperMethods() {
    if (null != methodFindTouchTargetView) {
      return;
    }

    try {
      Class<?> RCTTouchTargetHelper = Class.forName(CLASS_TOUCHTARGETHELPER);
      methodFindTouchTargetView = RCTTouchTargetHelper.getDeclaredMethod(
          METHOD_FIND_TOUCHTARGET_VIEW, float[].class, ViewGroup.class);
      methodFindTouchTargetView.setAccessible(true);
    } catch (ClassNotFoundException e) {
      Utility.logd(TAG, e);
    } catch (NoSuchMethodException e) {
      Utility.logd(TAG, e);
    }
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
  public void onReceive(Context context, Intent intent) {
    if (AccessTokenManager.ACTION_CURRENT_ACCESS_TOKEN_CHANGED.equals(intent.getAction())) {
      Utility.logd(TAG, "AccessTokenChanged");
      AccessToken oldAccessToken = (AccessToken) intent
          .getParcelableExtra(AccessTokenManager.EXTRA_OLD_ACCESS_TOKEN);
      AccessToken newAccessToken = (AccessToken) intent
          .getParcelableExtra(AccessTokenManager.EXTRA_NEW_ACCESS_TOKEN);
      onCurrentAccessTokenChanged(oldAccessToken, newAccessToken);
    }
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

@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();
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private static void writeSettingToCache(UserSetting userSetting) {
  validateInitialized();
  try {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put(VALUE, userSetting.value);
    jsonObject.put(LAST_TIMESTAMP, userSetting.lastTS);
    userSettingPrefEditor
        .putString(userSetting.keyInCache, jsonObject.toString())
        .commit();
  } catch (JSONException je) {
    Utility.logd(TAG, je);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private static void readSettingFromCache(UserSetting userSetting) {
  validateInitialized();
  try {
    String settingStr = userSettingPref.getString(userSetting.keyInCache, "");
    if (!settingStr.isEmpty()) {
      JSONObject setting = new JSONObject(settingStr);
      userSetting.value = setting.getBoolean(VALUE);
      userSetting.lastTS = setting.getLong(LAST_TIMESTAMP);
    }
  } catch (JSONException je) {
    Utility.logd(TAG, je);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

@Nullable
public static View getTouchReactView(float[] location, @Nullable View RCTRootView) {
  initTouchTargetHelperMethods();
  if (null == methodFindTouchTargetView || null == RCTRootView) {
    return null;
  }
  try {
    View nativeTargetView = (View)methodFindTouchTargetView
        .invoke(null, location, RCTRootView);
    if (nativeTargetView != null && nativeTargetView.getId() > 0) {
      View reactTargetView = (View)nativeTargetView.getParent();
      return reactTargetView != null ? reactTargetView : null;
    }
  } catch (IllegalAccessException e) {
    Utility.logd(TAG, e);
  } catch (InvocationTargetException e) {
    Utility.logd(TAG, e);
  }
  return null;
}

代码示例来源:origin: facebook/facebook-android-sdk

private static String md5Checksum(String toHash)
{
  String hash;
  try
  {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    byte[] bytes = toHash.getBytes("UTF-8");
    digest.update(bytes, 0, bytes.length);
    bytes = digest.digest();
    hash = AppEventUtility.bytesToHex( bytes );
  }
  catch(NoSuchAlgorithmException e )
  {
    Utility.logd("Failed to generate checksum: ", e);
    return "0";
  }
  catch(UnsupportedEncodingException e )
  {
    Utility.logd("Failed to generate checksum: ", e);
    return "1";
  }
  return hash;
}

代码示例来源:origin: facebook/facebook-android-sdk

public static Bundle parseUrlQueryString(String queryString) {
  Bundle params = new Bundle();
  if (!isNullOrEmpty(queryString)) {
    String array[] = queryString.split("&");
    for (String parameter : array) {
      String keyValuePair[] = parameter.split("=");
      try {
        if (keyValuePair.length == 2) {
          params.putString(
              URLDecoder.decode(keyValuePair[0], UTF8),
              URLDecoder.decode(keyValuePair[1], UTF8));
        } else if (keyValuePair.length == 1) {
          params.putString(
              URLDecoder.decode(keyValuePair[0], UTF8),
              "");
        }
      } catch (UnsupportedEncodingException e) {
        // shouldn't happen
        logd(LOG_TAG, e);
      }
    }
  }
  return params;
}

代码示例来源:origin: facebook/facebook-android-sdk

@TargetApi(16)
  private static void cleanUpAdvertisementServiceImpl(String userCode) {
    NsdManager.RegistrationListener nsdRegistrationListener =
        deviceRequestsListeners.get(userCode);
    if (nsdRegistrationListener != null) {
      NsdManager nsdManager = (NsdManager)FacebookSdk
          .getApplicationContext()
          .getSystemService(Context.NSD_SERVICE);

      try {
        nsdManager.unregisterService(nsdRegistrationListener);
      } catch (IllegalArgumentException e) {
        Utility.logd(TAG, e);
      }

      deviceRequestsListeners.remove(userCode);
    }
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
protected void onPreExecute() {
  super.onPreExecute();
  if (FacebookSdk.isDebugEnabled()) {
    Utility.logd(TAG, String.format("execute async task: %s", this));
  }
  if (requests.getCallbackHandler() == null) {
    // We want any callbacks to go to a handler on this thread unless a handler has already
    // been specified or we are not running on a thread without a looper.
    Handler handler;
    if (Thread.currentThread() instanceof HandlerThread) {
      handler = new Handler();
    } else {
      handler = new Handler(Looper.getMainLooper());
    }
    requests.setCallbackHandler(handler);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private static void loadSettingFromManifest(UserSetting userSetting) {
  validateInitialized();
  try {
    ApplicationInfo ai = FacebookSdk.getApplicationContext()
        .getPackageManager()
        .getApplicationInfo(
            FacebookSdk.getApplicationContext().getPackageName(),
            PackageManager.GET_META_DATA);
    if (ai != null && ai.metaData != null && ai.metaData.containsKey(userSetting.keyInManifest)) {
      // default value should not be used
      userSetting.value = ai.metaData.getBoolean(userSetting.keyInManifest, userSetting.defaultVal);
    }
  } catch (PackageManager.NameNotFoundException e) {
    Utility.logd(TAG, e);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private static boolean canShowWebCheck(ShareContent content) {
  if (!canShowWebTypeCheck(content.getClass())) {
    return false;
  }
  if (content instanceof ShareOpenGraphContent) {
    final ShareOpenGraphContent ogContent = ((ShareOpenGraphContent) content);
    try {
      ShareInternalUtility.toJSONObjectForWeb(ogContent);
    } catch (Exception e) {
      Utility.logd(
        TAG,
        "canShow returned false because the content of the Opem Graph object" +
          " can't be shared via the web dialog",
        e);
      return false;
    }
  }
  return true;
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
public void onAttachedToWindow() {
  isDetached = false;
  if (Utility.mustFixWindowParamsForAutofill(getContext())
      && windowParams != null && windowParams.token == null) {
    windowParams.token = getOwnerActivity().getWindow().getAttributes().token;
    Utility.logd(LOG_TAG, "Set token on onAttachedToWindow(): " + windowParams.token);
  }
  super.onAttachedToWindow();
}

代码示例来源:origin: facebook/facebook-android-sdk

private void addCommonParameters() {
  if (this.accessToken != null) {
    if (!this.parameters.containsKey(ACCESS_TOKEN_PARAM)) {
      String token = accessToken.getToken();
      Logger.registerAccessToken(token);
      this.parameters.putString(ACCESS_TOKEN_PARAM, token);
    }
  } else if (!skipClientToken && !this.parameters.containsKey(ACCESS_TOKEN_PARAM)) {
    String appID = FacebookSdk.getApplicationId();
    String clientToken = FacebookSdk.getClientToken();
    if (!Utility.isNullOrEmpty(appID) && !Utility.isNullOrEmpty(clientToken)) {
      String accessToken = appID + "|" + clientToken;
      this.parameters.putString(ACCESS_TOKEN_PARAM, accessToken);
    } else {
      Utility.logd(TAG, "Warning: Request without access token missing application ID or" +
          " client token.");
    }
  }
  this.parameters.putString(SDK_PARAM, SDK_ANDROID);
  this.parameters.putString(FORMAT_PARAM, FORMAT_JSON);
  if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_INFO)) {
    this.parameters.putString(DEBUG_PARAM, DEBUG_SEVERITY_INFO);
  } else if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_WARNING)) {
    this.parameters.putString(DEBUG_PARAM, DEBUG_SEVERITY_WARNING);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Intent intent = getIntent();
  // Some apps using this sdk don't put the sdk initialize code in the application
  // on create method. This can cause issues when opening this activity after an application
  // has been killed since the sdk won't be initialized. Attempt to initialize the sdk
  // here if it hasn't already been initialized.
  if (!FacebookSdk.isInitialized()) {
    Utility.logd(
        TAG,
        "Facebook SDK not initialized. Make sure you call sdkInitialize inside " +
            "your Application's onCreate method.");
    FacebookSdk.sdkInitialize(getApplicationContext());
  }
  setContentView(R.layout.com_facebook_activity_layout);
  if (PASS_THROUGH_CANCEL_ACTION.equals(intent.getAction())) {
    handlePassThroughError();
    return;
  }
  singleFragment = getFragment();
}

代码示例来源:origin: facebook/facebook-android-sdk

private static AttributionIdentifiers getAndroidIdViaService(Context context) {
  GoogleAdServiceConnection connection = new GoogleAdServiceConnection();
  Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
  intent.setPackage("com.google.android.gms");
  if(context.bindService(intent, connection, Context.BIND_AUTO_CREATE)) {
    try {
      GoogleAdInfo adInfo = new GoogleAdInfo(connection.getBinder());
      AttributionIdentifiers identifiers = new AttributionIdentifiers();
      identifiers.androidAdvertiserId = adInfo.getAdvertiserId();
      identifiers.limitTracking = adInfo.isTrackingLimited();
      return identifiers;
    } catch (Exception exception) {
      Utility.logd("android_id", exception);
    } finally {
      context.unbindService(connection);
    }
  }
  return null;
}

相关文章