Settings
最新版本的 SDK 已不再提供此課程。
有此級別的更新版本。前往查看 最新版本。

Allows some customization of sdk behavior.

伸延:Object
套件:facebook
建構函式
Settings()
public Settings()
類別方式
getLoggingBehaviors()

Certain logging behaviors are available for debugging beyond those that should be enabled in production.

Returns the types of extended logging that are currently enabled.

public static final Set getLoggingBehaviors()
Returns
A set containing enabled logging behaviors
addLoggingBehavior(LoggingBehavior)

Certain logging behaviors are available for debugging beyond those that should be enabled in production.

Enables a particular extended logging in the sdk.

public static final void addLoggingBehavior(LoggingBehavior behavior)
參數說明
behaviorThe LoggingBehavior to enable
removeLoggingBehavior(LoggingBehavior)

Certain logging behaviors are available for debugging beyond those that should be enabled in production.

Disables a particular extended logging behavior in the sdk.

public static final void removeLoggingBehavior(LoggingBehavior behavior)
參數說明
behaviorThe LoggingBehavior to disable
clearLoggingBehaviors()

Certain logging behaviors are available for debugging beyond those that should be enabled in production.

Disables all extended logging behaviors.

public static final void clearLoggingBehaviors()
isLoggingBehaviorEnabled(LoggingBehavior)

Certain logging behaviors are available for debugging beyond those that should be enabled in production.

Checks if a particular extended logging behavior is enabled.

public static final boolean isLoggingBehaviorEnabled(LoggingBehavior behavior)
參數說明
behaviorThe LoggingBehavior to check
Returns
Whether behavior is enabled
getExecutor()

Returns the Executor used by the SDK for non-AsyncTask background work.

By default this uses AsyncTask Executor via reflection if the API level is high enough. Otherwise this creates a new Executor with defaults similar to those used in AsyncTask.

public static Executor getExecutor()
Returns
An Executor used by the SDK. This will never be null.
setExecutor(Executor)

Sets the Executor used by the SDK for non-AsyncTask background work.

public static void setExecutor(Executor executor)
參數說明
executorThe Executor to use; must not be null.
getFacebookDomain()

Gets the base Facebook domain to use when making Web requests; in production code this will always be "facebook.com".

public static String getFacebookDomain()
Returns
The Facebook domain
setFacebookDomain(String)

Sets the base Facebook domain to use when making Web requests. This defaults to "facebook.com", but may be overridden to, e.g., "beta.facebook.com" to direct requests at a different domain. This method should never be called from production code.

public static void setFacebookDomain(String facebookDomain)
參數說明
facebookDomainThe base domain to use instead of "facebook.com"
publishInstallAsync(Context, String)

Manually publish install attribution to the Facebook graph. Internally handles tracking repeat calls to prevent multiple installs being published to the graph.

public static void publishInstallAsync(Context context, String applicationId)
參數說明
contextThe current Context
applicationIdThe fb application being published. This method is deprecated. See AppEventsLogger.activateApp(Context, String) for more info.
publishInstallAsync(Context, String, Callback)

Manually publish install attribution to the Facebook graph. Internally handles tracking repeat calls to prevent multiple installs being published to the graph.

public static void publishInstallAsync(Context context, String applicationId, Callback callback)
參數說明
contextThe current Context
applicationIdThe fb application being published.
callbackA callback to invoke with a Response object, carrying the server response, or an error. This method is deprecated. See AppEventsLogger.activateApp(Context, String) for more info.
setShouldAutoPublishInstall(boolean)

Sets whether opening a Session should automatically publish install attribution to the Facebook graph.

public static void setShouldAutoPublishInstall(boolean shouldAutoPublishInstall)
參數說明
shouldAutoPublishInstallTrue to automatically publish, false to not This method is deprecated. See AppEventsLogger.activateApp(Context, String) for more info.
getShouldAutoPublishInstall()

Gets whether opening a Session should automatically publish install attribution to the Facebook graph.

public static boolean getShouldAutoPublishInstall()
Returns
True to automatically publish, false to not This method is deprecated. See <a href='AppEventsLogger#activateApp(Context, String)'>AppEventsLogger.activateApp(Context, String)</a> for more info.
publishInstallAndWait(Context, String)

Manually publish install attribution to the Facebook graph. Internally handles tracking repeat calls to prevent multiple installs being published to the graph.

public static boolean publishInstallAndWait(Context context, String applicationId)
參數說明
contextThe current Context
applicationIdThe fb application being published.
Returns
Returns false on error. Applications should retry until true is returned. Safe to call again after true is returned. This method is deprecated. See <a href='AppEventsLogger#activateApp(Context, String)'>AppEventsLogger.activateApp(Context, String)</a> for more info.
publishInstallAndWaitForResponse(Context, String)

Manually publish install attribution to the Facebook graph. Internally handles caching repeat calls to prevent multiple installs being published to the graph.

public static Response publishInstallAndWaitForResponse(Context context, String applicationId)
參數說明
contextThe current Context
applicationIdThe fb application being published.
Returns
Returns a Response object, carrying the server response, or an error. This method is deprecated. See <a href='AppEventsLogger#activateApp(Context, String)'>AppEventsLogger.activateApp(Context, String)</a> for more info.
getAttributionId(ContentResolver)

Acquire the current attribution id from the facebook app.

public static String getAttributionId(ContentResolver contentResolver)
參數說明
contentResolver
Returns
Returns null if the facebook app is not present on the phone.
getAppVersion()

Gets the application version to the provided string.

public static String getAppVersion()
Returns
Application version set via setAppVersion.
setAppVersion(String)

Sets the application version to the provided string. AppEventsLogger.logEvent calls logs its event with the current app version, and App Insights allows breakdown of events by app version.

public static void setAppVersion(String appVersion)
參數說明
appVersionThe version identifier of the Android app that events are being logged through. Enables analysis and breakdown of logged events by app version.
getSdkVersion()

Gets the current version of the Facebook SDK for Android as a string.

public static String getSdkVersion()
Returns
The current version of the SDK
getMigrationBundle()

Gets the current Facebook migration bundle string; this string can be passed to Graph API endpoints to specify a set of platform migrations that are explicitly turned on or off for that call, in order to ensure compatibility between a given version of the SDK and the Graph API.

public static String getMigrationBundle()
Returns
The migration bundle supported by this version of the SDK