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

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

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

Utility.getMetadataApplicationId介绍

暂无

代码示例

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

/**
 * Notifies the events system that the app has been deactivated (put in the background) and
 * tracks the application session information. Should be called whenever your app becomes
 * inactive, typically in the onPause() method of each long-running Activity of your app.
 *
 * Use this method if your application ID is stored in application metadata, otherwise see
 * {@link AppEventsLogger#deactivateApp(android.content.Context, String)}.
 *
 * @param context Used to access the applicationId and the attributionId for non-authenticated
 *                users.
 * @deprecated When using {@link AppEventsLogger#activateApp(Application)} deactivate app will
 * be logged automatically.
 */
@Deprecated
@SuppressWarnings("deprecation")
public static void deactivateApp(Context context) {
  if (ActivityLifecycleTracker.isTracking()) {
    Log.w(TAG, "deactivateApp events are being logged automatically. " +
        "There's no need to call deactivateApp, this is safe to remove.");
    return;
  }
  deactivateApp(context, Utility.getMetadataApplicationId(context));
}

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

/**
 * Constructor that builds a dialog without an authenticated user.
 *
 * @param context the Context within which the dialog will be shown.
 * @param applicationId the application ID to be included in the dialog URL.
 * @param action the portion of the dialog URL following www.facebook.com/dialog/.
 *               See https://developers.facebook.com/docs/reference/dialogs/ for details.
 * @param parameters a Bundle containing parameters to pass as part of the URL.
 */
public Builder(Context context, String applicationId, String action, Bundle parameters) {
  if (applicationId == null) {
    applicationId = Utility.getMetadataApplicationId(context);
  }
  Validate.notNullOrEmpty(applicationId, "applicationId");
  this.applicationId = applicationId;
  finishInit(context, action, parameters);
}

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

private boolean isCustomTabsEnabled() {
  final String appId = Utility.getMetadataApplicationId(loginClient.getActivity());
  final FetchedAppSettings settings = FetchedAppSettingsManager.getAppSettingsWithoutQuery(appId);
  return settings != null && settings.getCustomTabsEnabled();
}

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

/**
 * Notifies the events system that the app has launched & logs an activatedApp event.  Should be
 * called whenever your app becomes active, typically in the onResume() method of each
 * long-running Activity of your app.
 * <p/>
 * Use this method if your application ID is stored in application metadata, otherwise see
 * {@link AppEventsLogger#activateApp(android.content.Context, String)}.
 *
 * @param context Used to access the applicationId and the attributionId for non-authenticated
 *                users.
 * @deprecated Use {@link AppEventsLogger#activateApp(Application)}
 */
@Deprecated
@SuppressWarnings("deprecation")
public static void activateApp(Context context) {
  if (ActivityLifecycleTracker.isTracking()) {
    Log.w(TAG, "activateApp events are being logged automatically. " +
        "There's no need to call activateApp explicitly, this is safe to remove.");
    return;
  }
  FacebookSdk.sdkInitialize(context);
  activateApp(context, Utility.getMetadataApplicationId(context));
}

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

/**
 * Asynchronously fetches app link information that might have been stored for use after
 * installation of the app
 *
 * @param context           The context
 * @param applicationId     Facebook application Id. If null, it is taken from the manifest
 * @param completionHandler CompletionHandler to be notified with the AppLinkData object or null
 *                          if none is available.  Must not be null.
 */
public static void fetchDeferredAppLinkData(
    Context context,
    String applicationId,
    final CompletionHandler completionHandler) {
  Validate.notNull(context, "context");
  Validate.notNull(completionHandler, "completionHandler");
  if (applicationId == null) {
    applicationId = Utility.getMetadataApplicationId(context);
  }
  Validate.notNull(applicationId, "applicationId");
  final Context applicationContext = context.getApplicationContext();
  final String applicationIdCopy = applicationId;
  FacebookSdk.getExecutor().execute(new Runnable() {
    @Override
    public void run() {
      fetchDeferredAppLinkFromServer(
          applicationContext, applicationIdCopy, completionHandler);
    }
  });
}

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

private void checkToolTipSettings() {
  switch (toolTipMode) {
    case AUTOMATIC:
      // kick off an async request
      final String appId = Utility.getMetadataApplicationId(getContext());
      FacebookSdk.getExecutor().execute(new Runnable() {
        @Override
        public void run() {
          final FetchedAppSettings settings = FetchedAppSettingsManager.queryAppSettings(appId, false);
          getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
              showToolTipPerSettings(settings);
            }
          });
        }
      });
      break;
    case DISPLAY_ALWAYS:
      String toolTipString = getResources().getString(
          R.string.com_facebook_tooltip_default);
      displayToolTip(toolTipString);
      break;
    case NEVER_DISPLAY:
      break;
  }
}

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

/**
 * Constructor that builds a dialog using either the current access token, or the
 * application id specified in the application/meta-data.
 *
 * @param context the Context within which the dialog will be shown.
 * @param action the portion of the dialog URL following www.facebook.com/dialog/.
 *               See https://developers.facebook.com/docs/reference/dialogs/ for details.
 * @param parameters a Bundle containing parameters to pass as part of the URL.
 */
public Builder(Context context, String action, Bundle parameters) {
  accessToken = AccessToken.getCurrentAccessToken();
  if (!AccessToken.isCurrentAccessTokenActive()) {
    String applicationId = Utility.getMetadataApplicationId(context);
    if (applicationId != null) {
      this.applicationId = applicationId;
    } else {
      throw new FacebookException("Attempted to create a builder without a valid" +
          " access token or a valid default Application ID.");
    }
  }
  finishInit(context, action, parameters);
}

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

protected AppEventsLogger(
    String activityName,
    String applicationId,
    AccessToken accessToken) {
  Validate.sdkInitialized();
  this.contextName = activityName;
  if (accessToken == null) {
    accessToken = AccessToken.getCurrentAccessToken();
  }
  // If we have a session and the appId passed is null or matches the session's app ID:
  if (AccessToken.isCurrentAccessTokenActive() &&
      (applicationId == null || applicationId.equals(accessToken.getApplicationId()))
      ) {
    accessTokenAppId = new AccessTokenAppIdPair(accessToken);
  } else {
    // If no app ID passed, get it from the manifest:
    if (applicationId == null) {
      applicationId = Utility.getMetadataApplicationId(
          FacebookSdk.getApplicationContext());
    }
    accessTokenAppId = new AccessTokenAppIdPair(null, applicationId);
  }
  initializeTimersIfNeeded();
}

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

applicationId = Utility.getMetadataApplicationId(context);

代码示例来源:origin: fr.avianey/facebook-android-api

/**
 * Notifies the events system that the app has been deactivated (put in the background) and
 * tracks the application session information. Should be called whenever your app becomes
 * inactive, typically in the onPause() method of each long-running Activity of your app.
 *
 * Use this method if your application ID is stored in application metadata, otherwise see
 * {@link AppEventsLogger#deactivateApp(android.content.Context, String)}.
 *
 * @param context Used to access the applicationId and the attributionId for non-authenticated users.
 */
public static void deactivateApp(Context context) {
  deactivateApp(context, Utility.getMetadataApplicationId(context));
}

代码示例来源:origin: fr.avianey/facebook-android-api

protected BuilderBase(Context context, String applicationId, String action, Bundle parameters) {
  if (applicationId == null) {
    applicationId = Utility.getMetadataApplicationId(context);
  }
  Validate.notNullOrEmpty(applicationId, "applicationId");
  this.applicationId = applicationId;
  finishInit(context, action, parameters);
}

代码示例来源:origin: fr.avianey/facebook-android-api

/**
 * Constructor.
 *
 * @param activity the Activity which is presenting the native Share dialog; must not be null
 */
public Builder(Activity activity) {
  Validate.notNull(activity, "activity");
  this.activity = activity;
  applicationId = Utility.getMetadataApplicationId(activity);
  appCall = new PendingCall(NativeProtocol.DIALOG_REQUEST_CODE);
}

代码示例来源:origin: fr.avianey/facebook-android-api

String applicationId = Utility.getMetadataApplicationId(context);

代码示例来源:origin: fr.avianey/facebook-android-api

/**
 * Notifies the events system that the app has launched & logs an activatedApp event.  Should be called whenever
 * your app becomes active, typically in the onResume() method of each long-running Activity of your app.
 *
 * Use this method if your application ID is stored in application metadata, otherwise see
 * {@link AppEventsLogger#activateApp(android.content.Context, String)}.
 *
 * @param context Used to access the applicationId and the attributionId for non-authenticated users.
 */
public static void activateApp(Context context) {
  Settings.sdkInitialize(context);
  activateApp(context, Utility.getMetadataApplicationId(context));
}

代码示例来源:origin: fr.avianey/facebook-android-api

private boolean initializeActiveSessionWithCachedToken(Context context) {
  if (context == null) {
    return false;
  }
  Session session = Session.getActiveSession();
  if (session != null) {
    return session.isOpened();
  }
  String applicationId = Utility.getMetadataApplicationId(context);
  if (applicationId == null) {
    return false;
  }
  return Session.openActiveSessionFromCache(context) != null;
}

代码示例来源:origin: fr.avianey/facebook-android-api

private void checkNuxSettings() {
  if (nuxMode == ToolTipMode.DISPLAY_ALWAYS) {
    String nuxString = getResources().getString(R.string.com_facebook_tooltip_default);
    displayNux(nuxString);
  } else {
    // kick off an async request
    final String appId = Utility.getMetadataApplicationId(getContext());
    AsyncTask<Void, Void, FetchedAppSettings> task = new AsyncTask<Void, Void, Utility.FetchedAppSettings>() {
      @Override
      protected FetchedAppSettings doInBackground(Void... params) {
        FetchedAppSettings settings = Utility.queryAppSettings(appId, false);
        return settings;
      }
      @Override
      protected void onPostExecute(FetchedAppSettings result) {
        showNuxPerSettings(result);
      }
    };
    task.execute((Void[])null);
  }
}

代码示例来源:origin: fr.avianey/facebook-android-api

/**
 * Asynchronously fetches app link information that might have been stored for use
 * after installation of the app
 * @param context The context
 * @param applicationId Facebook application Id. If null, it is taken from the manifest
 * @param completionHandler CompletionHandler to be notified with the AppLinkData object or null if none is
 *                          available.  Must not be null.
 */
public static void fetchDeferredAppLinkData(
    Context context,
    String applicationId,
    final CompletionHandler completionHandler) {
  Validate.notNull(context, "context");
  Validate.notNull(completionHandler, "completionHandler");
  if (applicationId == null) {
    applicationId = Utility.getMetadataApplicationId(context);
  }
  Validate.notNull(applicationId, "applicationId");
  final Context applicationContext = context.getApplicationContext();
  final String applicationIdCopy = applicationId;
  Settings.getExecutor().execute(new Runnable() {
    @Override
    public void run() {
      fetchDeferredAppLinkFromServer(applicationContext, applicationIdCopy, completionHandler);
    }
  });
}

代码示例来源:origin: fr.avianey/facebook-android-api

protected BuilderBase(Context context, String action) {
  Session activeSession = Session.getActiveSession();
  if (activeSession != null && activeSession.isOpened()) {
    this.session = activeSession;
  } else {
    String applicationId = Utility.getMetadataApplicationId(context);
    if (applicationId != null) {
      this.applicationId = applicationId;
    } else {
      throw new FacebookException("Attempted to create a builder without an open" +
          " Active Session or a valid default Application ID.");
    }
  }
  finishInit(context, action, null);
}

代码示例来源:origin: fr.avianey/facebook-android-api

applicationId = Utility.getMetadataApplicationId(context);

代码示例来源:origin: fr.avianey/facebook-android-api

applicationId = Utility.getMetadataApplicationId(context);

相关文章