當前位置: 首頁>>代碼示例>>Java>>正文


Java Validate.hasInternetPermissions方法代碼示例

本文整理匯總了Java中com.facebook.internal.Validate.hasInternetPermissions方法的典型用法代碼示例。如果您正苦於以下問題:Java Validate.hasInternetPermissions方法的具體用法?Java Validate.hasInternetPermissions怎麽用?Java Validate.hasInternetPermissions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.internal.Validate的用法示例。


在下文中一共展示了Validate.hasInternetPermissions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sdkInitialize

import com.facebook.internal.Validate; //導入方法依賴的package包/類
/**
 * 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.
 * @param applicationContext The application context
 * @param callback A callback called when initialize finishes. This will be called even if the
 *                 sdk is already initialized.
 */
public static synchronized void sdkInitialize(
        Context applicationContext,
        final InitializeCallback callback) {
    if (sdkInitialized) {
        if (callback != null) {
            callback.onInitialized();
        }
        return;
    }

    Validate.notNull(applicationContext, "applicationContext");

    // Don't throw for these validations here, just log an error. We'll throw when we actually
    // need them
    Validate.hasFacebookActivity(applicationContext, false);
    Validate.hasInternetPermissions(applicationContext, false);

    FacebookSdk.applicationContext = applicationContext.getApplicationContext();

    // Make sure we've loaded default settings if we haven't already.
    FacebookSdk.loadDefaultsFromMetadata(FacebookSdk.applicationContext);
    // Load app settings from network so that dialog configs are available
    Utility.loadAppSettingsAsync(FacebookSdk.applicationContext, applicationId);
    // Fetch available protocol versions from the apps on the device
    NativeProtocol.updateAllAvailableProtocolVersionsAsync();

    BoltsMeasurementEventListener.getInstance(FacebookSdk.applicationContext);

    cacheDir = new LockOnGetVariable<File>(
            new Callable<File>() {
                @Override
                public File call() throws Exception {
                    return FacebookSdk.applicationContext.getCacheDir();
                }
            });

    FutureTask<Void> accessTokenLoadFutureTask =
            new FutureTask<Void>(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    AccessTokenManager.getInstance().loadCurrentAccessToken();
                    ProfileManager.getInstance().loadCurrentProfile();
                    if (AccessToken.getCurrentAccessToken() != null &&
                            Profile.getCurrentProfile() == null) {
                        // Access token and profile went out of sync due to a network or caching
                        // issue, retry
                        Profile.fetchProfileForCurrentAccessToken();
                    }

                    if (callback != null) {
                        callback.onInitialized();
                    }
                    return null;
                }
            });
    getExecutor().execute(accessTokenLoadFutureTask);

    sdkInitialized = true;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:67,代碼來源:FacebookSdk.java


注:本文中的com.facebook.internal.Validate.hasInternetPermissions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。