FacebookSdk
เวอร์ชั่นที่ใหม่กว่าของคลาสนี้พร้อมแล้ว ตรวจสอบได้ เวอร์ชั่นล่าสุด

This class allows some customization of Facebook SDK behavior.

ขยาย:Object
แพ็คเกจ:facebook
ผู้สร้าง
FacebookSdk()
public FacebookSdk()
วิธีการคลาส
sdkInitialize(Context, int)

This function initializes the Facebook SDK, the behavior of Facebook SDK functions are undetermined if this function is not called. It should be called as early as possible.

public static synchronized void sdkInitialize(Context applicationContext, int callbackRequestCodeOffset)
พารามิเตอร์คำอธิบาย
applicationContextThe application context
callbackRequestCodeOffsetThe request code offset that Facebook activities will be called with. Please do not use the range between the value you set and another 100 entries after it in your other requests.
sdkInitialize(Context, int, InitializeCallback)

This function initializes the Facebook SDK, the behavior of Facebook SDK functions are undetermined if this function is not called. It should be called as early as possible.

public static synchronized void sdkInitialize(Context applicationContext, int callbackRequestCodeOffset, InitializeCallback callback)
พารามิเตอร์คำอธิบาย
applicationContextThe application context
callbackRequestCodeOffsetThe request code offset that Facebook activities will be called with. Please do not use the range between the value you set and another 100 entries after it in your other requests.
callbackA callback called when initialize finishes. This will be called even if the sdk is already initialized.
sdkInitialize(Context)

This function initializes the Facebook SDK, the behavior of Facebook SDK functions are undetermined if this function is not called. It should be called as early as possible.

public static synchronized void sdkInitialize(Context applicationContext)
พารามิเตอร์คำอธิบาย
applicationContextThe application context
sdkInitialize(Context, InitializeCallback)

This function initializes the Facebook SDK, the behavior of Facebook SDK functions are undetermined if this function is not called. It should be called as early as possible.

public static synchronized void sdkInitialize(Context applicationContext, InitializeCallback callback)
พารามิเตอร์คำอธิบาย
applicationContextThe application context
callbackA callback called when initialize finishes. This will be called even if the sdk is already initialized.
isInitialized()

Indicates whether the Facebook SDK has been initialized.

public static synchronized boolean isInitialized()
Returns
True if initialized, false if not
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 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 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 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 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 boolean isLoggingBehaviorEnabled(LoggingBehavior behavior)
พารามิเตอร์คำอธิบาย
behaviorThe LoggingBehavior to check
Returns
Whether behavior is enabled
isDebugEnabled()

Indicates if we are in debug mode.

public static boolean isDebugEnabled()
setIsDebugEnabled(boolean)

Used to enable or disable logging, and other debug features. Defaults to BuildConfig.DEBUG.

public static void setIsDebugEnabled(boolean enabled)
พารามิเตอร์คำอธิบาย
enabledDebug features (like logging) are enabled if true, disabled if false.
isLegacyTokenUpgradeSupported()

Indicates if the SDK should fallback and read the legacy token. This is turned off by default for performance.

public static boolean isLegacyTokenUpgradeSupported()
Returns
If the legacy token upgrade is supported.
setLegacyTokenUpgradeSupported(boolean)

Setter for legacy token upgrade.

public static void setLegacyTokenUpgradeSupported(boolean supported)
พารามิเตอร์คำอธิบาย
supportedTrue if upgrade should be supported.
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"
getApplicationContext()

The getter for the context of the current application.

public static Context getApplicationContext()
Returns
The context of the current application.
publishInstallAsync(Context, String)

This method is public in order to be used by app events, please don't use directly.

public static void publishInstallAsync(Context context, String applicationId)
พารามิเตอร์คำอธิบาย
contextThe application context.
applicationIdThe application id.
getSdkVersion()

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

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

Returns whether data such as those generated through AppEventsLogger and sent to Facebook should be restricted from being used for purposes other than analytics and conversions, such as targeting ads to this user. Defaults to false. This value is stored on the device and persists across app launches.

public static boolean getLimitEventAndDataUsage(Context context)
พารามิเตอร์คำอธิบาย
contextUsed to read the value.
setLimitEventAndDataUsage(Context, boolean)

Sets whether data such as those generated through AppEventsLogger and sent to Facebook should be restricted from being used for purposes other than analytics and conversions, such as targeting ads to this user. Defaults to false. This value is stored on the device and persists across app launches. Changes to this setting will apply to app events currently queued to be flushed.

public static void setLimitEventAndDataUsage(Context context, boolean limitEventUsage)
พารามิเตอร์คำอธิบาย
contextUsed to persist this value across app runs.
limitEventUsage
getOnProgressThreshold()

Gets the threshold used to report progress on requests.

public static long getOnProgressThreshold()
setOnProgressThreshold(long)

Sets the threshold used to report progress on requests. Note that the value will be read when the request is started and cannot be changed during a request (or batch) execution.

public static void setOnProgressThreshold(long threshold)
พารามิเตอร์คำอธิบาย
thresholdThe number of bytes progressed to force a callback.
getApplicationSignature(Context)

Internal call please don't use directly.

public static String getApplicationSignature(Context context)
พารามิเตอร์คำอธิบาย
contextThe application context.
Returns
The application signature.
getApplicationId()

Gets the Facebook application ID for the current app. This should only be called after the SDK has been initialized by calling FacebookSdk.sdkInitialize().

public static String getApplicationId()
Returns
The application ID
setApplicationId(String)

Sets the Facebook application ID for the current app.

public static void setApplicationId(String applicationId)
พารามิเตอร์คำอธิบาย
applicationIdThe application ID
getApplicationName()

Gets the Facebook application name of the current app. This should only be called after the SDK has been initialized by calling FacebookSdk.sdkInitialize().

public static String getApplicationName()
Returns
The application name
setApplicationName(String)

Sets the Facebook application name for the current app.

public static void setApplicationName(String applicationName)
พารามิเตอร์คำอธิบาย
applicationNameThe application name
getClientToken()

Gets the client token for the current app. This will be null unless explicitly set or unless loadDefaultsFromMetadata has been called.

public static String getClientToken()
Returns
The client token
setClientToken(String)

Sets the Facebook client token for the current app.

public static void setClientToken(String clientToken)
พารามิเตอร์คำอธิบาย
clientTokenThe client token
getWebDialogTheme()

Gets the theme used by WebDialog

public static int getWebDialogTheme()
Returns
The theme
setWebDialogTheme(int)

Sets the theme used by WebDialog

public static void setWebDialogTheme(int theme)
พารามิเตอร์คำอธิบาย
themeA theme to use
getCacheDir()

Gets the cache directory to use for caching responses, etc. The default will be the value returned by Context.getCacheDir() when the SDK was initialized, but it can be overridden.

public static File getCacheDir()
Returns
The cache directory
setCacheDir(File)

Sets the cache directory to use for caching responses, etc.

public static void setCacheDir(File cacheDir)
พารามิเตอร์คำอธิบาย
cacheDirThe cache directory
getCallbackRequestCodeOffset()

Getter for the callback request code offset. The request codes starting at this offset and the next 100 values are used by the Facebook SDK.

public static int getCallbackRequestCodeOffset()
Returns
The callback request code offset.
isFacebookRequestCode(int)

Returns true if the request code is within the range used by Facebook SDK requests. This does not include request codes that you explicitly set on the dialogs, buttons or LoginManager. The range of request codes that the SDK uses starts at the callbackRequestCodeOffset and continues for the next 100 values.

public static boolean isFacebookRequestCode(int requestCode)
พารามิเตอร์คำอธิบาย
requestCodeThe request code to check.
Returns
True if the request code is within the range used by the Facebook SDK.
ค่าคงตัว
APPLICATION_ID_PROPERTY
The key for the application ID in the Android manifest.
public static final String APPLICATION_ID_PROPERTY
APPLICATION_NAME_PROPERTY
The key for the application name in the Android manifest.
public static final String APPLICATION_NAME_PROPERTY
CLIENT_TOKEN_PROPERTY
The key for the client token in the Android manifest.
public static final String CLIENT_TOKEN_PROPERTY
WEB_DIALOG_THEME
The key for the web dialog theme in the Android manifest.
public static final String WEB_DIALOG_THEME