-
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
Nested Classes Modifier and Type Class Description public interface
Utility.GraphMeRequestWithCacheCallback
-
Field Summary
Fields Modifier and Type Field Description private final String
LOG_TAG
private final Integer
DEFAULT_STREAM_BUFFER_SIZE
private Long
availableExternalStorageGB
private String
deviceTimeZoneName
private String
carrierName
private String
versionName
private Locale
locale
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 Boolean isNullOrEmpty(Collection<?> c)
-
isNullOrEmpty
final static Boolean isNullOrEmpty(String s)
-
coerceValueIfNullOrEmpty
final static String coerceValueIfNullOrEmpty(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 String sha256hash(String key)
-
sha256hash
final static String sha256hash(ByteArray bytes)
-
parseUrlQueryString
final static Bundle parseUrlQueryString(String queryString)
-
putNonEmptyString
final static Unit putNonEmptyString(Bundle b, String key, String value)
-
putCommaSeparatedStringList
final static Unit putCommaSeparatedStringList(Bundle b, String key, List<String> list)
-
putJSONValueInBundle
final static Boolean putJSONValueInBundle(Bundle bundle, String key, Object value)
-
closeQuietly
final static Unit closeQuietly(Closeable closeable)
-
disconnectQuietly
final static Unit disconnectQuietly(URLConnection connection)
-
getMetadataApplicationId
final static String getMetadataApplicationId(Context context)
-
convertJSONObjectToHashMap
final static Map<String, Object> convertJSONObjectToHashMap(JSONObject jsonObject)
-
convertJSONObjectToStringMap
final static Map<String, String> convertJSONObjectToStringMap(JSONObject jsonObject)
-
convertJSONArrayToHashSet
final static <ERROR CLASS><String> convertJSONArrayToHashSet(JSONArray jsonArray)
-
convertJSONArrayToList
final static List<String> convertJSONArrayToList(JSONArray jsonArray)
-
getStringPropertyAsJSON
final static Object getStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)
-
readStreamToString
final static String readStreamToString(InputStream inputStream)
-
copyAndCloseInputStream
final static Integer copyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)
-
stringsEqualOrEmpty
final static Boolean stringsEqualOrEmpty(String a, String b)
-
clearFacebookCookies
final static Unit clearFacebookCookies(Context context)
-
areObjectsEqual
final static <T extends Any> Boolean areObjectsEqual(T a, T b)
-
safeGetStringFromResponse
final static String safeGetStringFromResponse(JSONObject response, String propertyName)
-
tryGetJSONObjectFromResponse
final static JSONObject tryGetJSONObjectFromResponse(JSONObject response, String propertyKey)
-
tryGetJSONArrayFromResponse
final static JSONArray tryGetJSONArrayFromResponse(JSONObject response, String propertyKey)
-
jsonArrayToStringList
final static List<String> jsonArrayToStringList(JSONArray jsonArray)
-
jsonArrayToSet
final static Set<String> jsonArrayToSet(JSONArray jsonArray)
-
mapToJsonStr
final static String mapToJsonStr(Map<String, String> map)
-
jsonStrToMap
final static Map<String, String> jsonStrToMap(String str)
-
setAppEventAttributionParameters
final static Unit setAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)
-
getAppVersion
final static String getAppVersion()
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 Unit setAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)
-
getMethodQuietly
final static Method getMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)
-
getMethodQuietly
final static Method getMethodQuietly(String className, String methodName, Class<?> parameterTypes)
-
invokeMethodQuietly
final static Object invokeMethodQuietly(Object receiver, Method method, Object args)
-
getActivityName
final static String getActivityName(Context context)
Returns the name of the current activity if the context is an activity, otherwise return "unknown"
-
getUriString
final static String getUriString(Uri uri)
-
isContentUri
final static Boolean isContentUri(Uri uri)
-
getContentSize
final static Long getContentSize(Uri contentUri)
-
getBundleLongAsDate
final static Date getBundleLongAsDate(Bundle bundle, String key, Date dateBase)
-
writeStringMapToParcel
final static Unit writeStringMapToParcel(Parcel parcel, Map<String, String> map)
-
readStringMapFromParcel
final static Map<String, String> readStringMapFromParcel(Parcel parcel)
-
writeNonnullStringMapToParcel
final static Unit writeNonnullStringMapToParcel(Parcel parcel, Map<String, String> map)
-
readNonnullStringMapFromParcel
final static Map<String, String> readNonnullStringMapFromParcel(Parcel parcel)
-
isCurrentAccessToken
final static Boolean isCurrentAccessToken(AccessToken token)
-
getGraphDomainFromTokenDomain
final static String getGraphDomainFromTokenDomain(String tokenGraphDomain)
-
getGraphMeRequestWithCacheAsync
final static Unit getGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)
-
awaitGetGraphMeRequestWithCache
final static JSONObject awaitGetGraphMeRequestWithCache(String accessToken)
-
generateRandomString
final static String generateRandomString(Integer length)
-
mustFixWindowParamsForAutofill
final static Boolean mustFixWindowParamsForAutofill(Context context)
-
isAutofillAvailable
final static Boolean isAutofillAvailable(Context context)
-
isChromeOS
final static Boolean isChromeOS(Context context)
Determines whether the application is running on Chrome OS or not
- Parameters:
context
- the Context
-
runOnNonUiThread
final static Unit runOnNonUiThread(Runnable runnable)
-
getAppName
final static String getAppName(Context context)
-
getLOG_TAG
final String getLOG_TAG()
-
getDEFAULT_STREAM_BUFFER_SIZE
final Integer getDEFAULT_STREAM_BUFFER_SIZE()
-
getAvailableExternalStorageGB
final Long getAvailableExternalStorageGB()
-
setAvailableExternalStorageGB
final Unit setAvailableExternalStorageGB(Long availableExternalStorageGB)
-
getDeviceTimeZoneName
final String getDeviceTimeZoneName()
-
setDeviceTimeZoneName
final Unit setDeviceTimeZoneName(String deviceTimeZoneName)
-
getCarrierName
final String getCarrierName()
-
setCarrierName
final Unit setCarrierName(String carrierName)
-
getVersionName
final String getVersionName()
-
setVersionName
final Unit setVersionName(String versionName)
-
getResourceLocale
final static Locale getResourceLocale()
-
getCurrentLocale
final static Locale getCurrentLocale()
-
getIsAutoAppLinkSetup
final static Boolean getIsAutoAppLinkSetup()
-
getDataProcessingOptions
final static JSONObject getDataProcessingOptions()
-
getIsDataProcessingRestricted
final static Boolean getIsDataProcessingRestricted()
-
-
-
-