เวอร์ชั่น Android SDK
- Mutable
- CollectionMapper
- AppCall
- CustomTab
- CustomTabUtils
- DialogFeature
- DialogPresenter
- FacebookDialogBase
- FacebookDialogFragment
- GamingAction
- FacebookWebFallbackDialog
- FragmentWrapper
- InstagramCustomTab
- PlatformServiceClient
- WebDialog
- AnalyticsEvents
- AttributionIdentifiers
- BoltsMeasurementEventListener
- BundleJSONConverter
- CallbackManagerImpl
- FacebookInitProvider
- FacebookRequestErrorClassification
- FacebookSignatureValidator
- FeatureManager
- FetchedAppGateKeepersManager
- FetchedAppSettings
- FetchedAppSettingsManager
- FileLruCache
- ImageDownloader
- ImageRequest
- ImageResponse
- ImageResponseCache
- InstallReferrerUtil
- InternalSettings
- LockOnGetVariable
- Logger
- NativeAppCallAttachmentStore
- NativeProtocol
- ServerProtocol
- SmartLoginOption
- UrlRedirectCache
- Utility
- Validate
- WorkQueue
- MessageDialog
- SendButton
- ShareButton
- ShareButtonBase
- GameRequestDialog
- ShareDialog
- MessageDialogFeature
- VideoUploader
- GameRequestValidation
- CameraEffectFeature
- CameraEffectJSONUtility
- LegacyNativeDialogParameters
- NativeDialogParameters
- ResultProcessor
- ShareConstants
- ShareContentValidation
- ShareDialogFeature
- ShareFeedContent
- ShareInternalUtility
- ShareStoryFeature
- WebDialogParameters
- ShareApi
- ShareBuilder
- Sharer
- Share
- ShareToMessengerParamsBuilder
- Messenger
- MessengerThreadParams
- MessengerUtils
- ShareToMessengerParams
- FacebookAppLinkResolver
- AppLinkData
- AppLinks
- AggregateException
- AppLink
- AppLinkResolver
- AppLinks
- CancellationToken
- CancellationTokenRegistration
- CancellationTokenSource
- Continuation
- ExecutorException
- Task
- TaskCompletionSource
- UnobservedTaskException
- AccessTokenTracker
- AuthenticationTokenTracker
- CustomTabActivity
- CustomTabMainActivity
- FacebookActivity
- FacebookAuthorizationException
- FacebookButtonBase
- FacebookCallback
- FacebookDialog
- FacebookDialogException
- LoginStatusCallback
- WebDialog
- AccessToken
- AccessTokenManager
- AccessTokenSource
- AuthenticationToken
- AuthenticationTokenCache
- AuthenticationTokenClaims
- AuthenticationTokenHeader
- AuthenticationTokenManager
- CallbackManager
- CurrentAccessTokenExpirationBroadcastReceiver
- FacebookBroadcastReceiver
- FacebookContentProvider
- FacebookException
- FacebookGraphResponseException
- FacebookOperationCanceledException
- FacebookRequestError
- FacebookSdk
- FacebookSdkNotInitializedException
- FacebookServiceException
- GraphRequest
- GraphRequestAsyncTask
- GraphRequestBatch
- GraphResponse
- HttpMethod
- LoggingBehavior
- Profile
- ProfileCache
- ProfileManager
- ProfileTracker
- ProgressNoopOutputStream
- ProgressOutputStream
- RequestProgress
- Common
- DeviceRequestsHelper
- EndToEndDumper
- CodeChallengeMethod
- CustomTabLoginMethodHandler
- CustomTabPrefetchHelper
- DeviceAuthDialog
- DeviceAuthMethodHandler
- GetTokenLoginMethodHandler
- KatanaProxyLoginMethodHandler
- LoginBehavior
- LoginClient
- LoginConfiguration
- LoginFragment
- LoginManager
- LoginMethodHandler
- LoginResult
- NativeAppLoginMethodHandler
- NonceUtil
- WebLoginMethodHandler
- WebViewLoginMethodHandler
- DefaultAudience
- LoginTargetApp
- DeviceLoginManager
- Login
- AppGroupCreationContent
- CameraEffectArguments
- CameraEffectTextures
- GameRequestContent
- ShareCameraEffectContent
- ShareContent
- ShareHashtag
- ShareLinkContent
- ShareMedia
- ShareMediaContent
- ShareMessengerActionButton
- ShareMessengerURLActionButton
- ShareModel
- ShareModelBuilder
- SharePhoto
- SharePhotoContent
- ShareStoryContent
- ShareVideo
- ShareVideoContent
- AccessTokenAppIdPair
- AppEvent
- AppEventsConstants
- AppEventsLogger
- AppEventsManager
- FlushResult
- InternalAppEventsLogger
- UserDataStore
- MetadataIndexer
- MetadataRule
- SettingsAPIFields
- AppEventsCAPIManager
- CustomEventField
- AppEventType
- AppEventUserAndAppDataField
- ConversionsAPISection
- ConversionsAPICustomEventField
- ConversionsAPIUserAndAppDataField
- ConversionsAPIEventName
- OtherEventConstants
- AppEventsConversionsAPITransformer
- AppEventsConversionsAPITransformerWebRequests
- CodelessLoggingEventListener
- CodelessManager
- RCTCodelessLoggingEventListener
- ViewIndexer
- Constants
- EventBinding
- ParameterComponent
- PathComponent
- SensitiveUserDataUtils
- UnityReflection
- ViewHierarchy
- EventDeactivationManager
- InAppPurchaseActivityLifecycleTracker
- InAppPurchaseAutoLogger
- InAppPurchaseBillingClientWrapper
- InAppPurchaseEventManager
- InAppPurchaseLoggerManager
- InAppPurchaseManager
- InAppPurchaseSkuDetailsWrapper
- InAppPurchaseUtils
- IntegrityManager
- ActivityLifecycleTracker
- AppEventUtility
- AppEventsLoggerUtility
- AutomaticAnalyticsLogger
- Constants
- FileDownloadTask
- ViewHierarchyConstants
- MTensor
- Model
- ModelManager
- Utils
- OnDeviceProcessingManager
- RemoteServiceWrapper
- RestrictiveDataManager
- SuggestedEventsManager
- ViewOnClickListener
- Core
- GateKeeper
- GateKeeperRuntimeCache
- ExceptionAnalyzer
- InstrumentData
- InstrumentManager
- InstrumentUtility
- ANRDetector
- ANRHandler
- CrashHandler
- AutoHandleExceptions
- CrashShieldHandler
- NoAutoExceptionHandling
- ErrorReportData
- ErrorReportHandler
- ThreadCheckHandler
- Excuse
- ExcusesForDesignViolations
- CertificateUtil
- OidcSecurityUtil
- DeviceLoginButton
- LoginButton
- ProfilePictureView
- ToolTipPopup
- All
public class Utility
com.facebook.internal is solely for the use of other packages within the Facebook SDK for Android. Use of any of the classes in this package is unsupported, and they may be modified or removed without warning at any time.
Nested Class Summary
Modifier and Type | Class | Description |
---|---|---|
public interface | Utility.GraphMeRequestWithCacheCallback |
Field Summary
Modifier and Type | Field | Description |
---|---|---|
private final String | LOG_TAG | |
private final Integer | DEFAULT_STREAM_BUFFER_SIZE | |
private final Locale | resourceLocale | |
private final Locale | currentLocale | |
private final static Boolean | isAutoAppLinkSetup | |
private final JSONObject | dataProcessingOptions | |
private final Boolean | isDataProcessingRestricted | |
public final static Utility | INSTANCE |
Method Summary
Method Detail
isNullOrEmpty
final static BooleanisNullOrEmpty(Collection<?> c)
isNullOrEmpty
final static BooleanisNullOrEmpty(String s)
coerceValueIfNullOrEmpty
final static StringcoerceValueIfNullOrEmpty(String s, String valueIfNullOrEmpty)
Use this when you want to normalize empty and null strings This way, Utility.areObjectsEqual can used for comparison, where a null string is to be treated the same as an empty string.
Parameters:
s
- The string to coercevalueIfNullOrEmpty
- The value if s is null or empty.sha256hash
final static Stringsha256hash(String key)
sha256hash
final static Stringsha256hash(ByteArray bytes)
parseUrlQueryString
final static BundleparseUrlQueryString(String queryString)
putNonEmptyString
final static UnitputNonEmptyString(Bundle b, String key, String value)
putCommaSeparatedStringList
final static UnitputCommaSeparatedStringList(Bundle b, String key, List<String> list)
putJSONValueInBundle
final static BooleanputJSONValueInBundle(Bundle bundle, String key, Object value)
closeQuietly
final static UnitcloseQuietly(Closeable closeable)
disconnectQuietly
final static UnitdisconnectQuietly(URLConnection connection)
getMetadataApplicationId
final static StringgetMetadataApplicationId(Context context)
convertJSONObjectToHashMap
final static Map<String, Object> convertJSONObjectToHashMap(JSONObject jsonObject)
convertJSONObjectToStringMap
final static Map<String, String> convertJSONObjectToStringMap(JSONObject jsonObject)
convertJSONArrayToList
final static List<String> convertJSONArrayToList(JSONArray jsonArray)
getStringPropertyAsJSON
final static ObjectgetStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)
readStreamToString
final static StringreadStreamToString(InputStream inputStream)
copyAndCloseInputStream
final static IntegercopyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)
stringsEqualOrEmpty
final static BooleanstringsEqualOrEmpty(String a, String b)
clearFacebookCookies
final static UnitclearFacebookCookies(Context context)
areObjectsEqual
final static <T extends Any> BooleanareObjectsEqual(T a, T b)
safeGetStringFromResponse
final static StringsafeGetStringFromResponse(JSONObject response, String propertyName)
tryGetJSONObjectFromResponse
final static JSONObjecttryGetJSONObjectFromResponse(JSONObject response, String propertyKey)
tryGetJSONArrayFromResponse
final static JSONArraytryGetJSONArrayFromResponse(JSONObject response, String propertyKey)
jsonArrayToStringList
final static List<String> jsonArrayToStringList(JSONArray jsonArray)
jsonArrayToSet
final static Set<String> jsonArrayToSet(JSONArray jsonArray)
mapToJsonStr
final static StringmapToJsonStr(Map<String, String> map)
jsonStrToMap
final static Map<String, String> jsonStrToMap(String str)
setAppEventAttributionParameters
final static UnitsetAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)
getAppVersion
final static StringgetAppVersion()
Get the app version of the app, as specified by the manifest.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.
setAppEventExtendedDeviceInfoParameters
final static UnitsetAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)
getMethodQuietly
final static MethodgetMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)
getMethodQuietly
final static MethodgetMethodQuietly(String className, String methodName, Class<?> parameterTypes)
invokeMethodQuietly
final static ObjectinvokeMethodQuietly(Object receiver, Method method, Object args)
getActivityName
final static StringgetActivityName(Context context)
Returns the name of the current activity if the context is an activity, otherwise return "unknown"
getUriString
final static StringgetUriString(Uri uri)
isContentUri
final static BooleanisContentUri(Uri uri)
getContentSize
final static LonggetContentSize(Uri contentUri)
getBundleLongAsDate
final static DategetBundleLongAsDate(Bundle bundle, String key, Date dateBase)
writeStringMapToParcel
final static UnitwriteStringMapToParcel(Parcel parcel, Map<String, String> map)
readStringMapFromParcel
final static Map<String, String> readStringMapFromParcel(Parcel parcel)
writeNonnullStringMapToParcel
final static UnitwriteNonnullStringMapToParcel(Parcel parcel, Map<String, String> map)
readNonnullStringMapFromParcel
final static Map<String, String> readNonnullStringMapFromParcel(Parcel parcel)
isCurrentAccessToken
final static BooleanisCurrentAccessToken(AccessToken token)
getGraphDomainFromTokenDomain
final static StringgetGraphDomainFromTokenDomain(String tokenGraphDomain)
getGraphMeRequestWithCacheAsync
final static UnitgetGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)
awaitGetGraphMeRequestWithCache
final static JSONObjectawaitGetGraphMeRequestWithCache(String accessToken)
generateRandomString
final static StringgenerateRandomString(Integer length)
mustFixWindowParamsForAutofill
final static BooleanmustFixWindowParamsForAutofill(Context context)
isAutofillAvailable
final static BooleanisAutofillAvailable(Context context)
isChromeOS
final static BooleanisChromeOS(Context context)
Determines whether the application is running on Chrome OS or not
Parameters:
context
- the ContextrunOnNonUiThread
final static UnitrunOnNonUiThread(Runnable runnable)
getAppName
final static StringgetAppName(Context context)
getLOG_TAG
final StringgetLOG_TAG()
getDEFAULT_STREAM_BUFFER_SIZE
final IntegergetDEFAULT_STREAM_BUFFER_SIZE()
getResourceLocale
final static LocalegetResourceLocale()
getCurrentLocale
final static LocalegetCurrentLocale()
getIsAutoAppLinkSetup
final static BooleangetIsAutoAppLinkSetup()
getDataProcessingOptions
final static JSONObjectgetDataProcessingOptions()
getIsDataProcessingRestricted
final static BooleangetIsDataProcessingRestricted()