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


Java FacebookSdk.getApplicationId方法代碼示例

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


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

示例1: shareToMessenger20150314

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private static void shareToMessenger20150314(
    Activity activity,
    int requestCode,
    ShareToMessengerParams shareToMessengerParams) {
  try {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    shareIntent.setPackage(PACKAGE_NAME);
    shareIntent.putExtra(Intent.EXTRA_STREAM, shareToMessengerParams.uri);
    shareIntent.setType(shareToMessengerParams.mimeType);
    String appId = FacebookSdk.getApplicationId();
    if (appId != null) {
      shareIntent.putExtra(EXTRA_PROTOCOL_VERSION, PROTOCOL_VERSION_20150314);
      shareIntent.putExtra(EXTRA_APP_ID, appId);
      shareIntent.putExtra(EXTRA_METADATA, shareToMessengerParams.metaData);
      shareIntent.putExtra(EXTRA_EXTERNAL_URI, shareToMessengerParams.externalUri);
    }

    activity.startActivityForResult(shareIntent, requestCode);
  } catch (ActivityNotFoundException e) {
    Intent openMessenger = activity.getPackageManager().getLaunchIntentForPackage(PACKAGE_NAME);
    activity.startActivity(openMessenger);
  }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:25,代碼來源:MessengerUtils.java

示例2: setupFacebookLogin

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private void setupFacebookLogin() {
    //TODO: Check if facebook login is actvated in the server
    String appId = FacebookSdk.getApplicationId();
    Timber.d("appId: " + appId);
    if (appId != null) {
        mCallbackManager = CallbackManager.Factory.create();
        mFacebookButton.setReadPermissions(PERMISSIONS);
        mFacebookButton.registerCallback(mCallbackManager, mFacebookCallback);
        mAccessTokenTracker = new AccessTokenTracker() {
            @Override
            protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {
                if (currentAccessToken != null) {
                    mRxRocketMethods.loginWithFacebook(currentAccessToken.getToken(), currentAccessToken.getExpires().getTime() - new Date().getTime())
                            .subscribeOn(Schedulers.io())
                            .observeOn(AndroidSchedulers.mainThread())
                            .subscribe(mLoginSubscriber);

                }
            }
        };

    } else {
        mFacebookButton.setVisibility(View.GONE);
    }

}
 
開發者ID:lukamarin,項目名稱:Rocket.Chat-android,代碼行數:27,代碼來源:LoginActivity.java

示例3: createLoginRequest

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private LoginClient.Request createLoginRequest(Collection<String> permissions) {
    LoginClient.Request request = new LoginClient.Request(
            loginBehavior,
            Collections.unmodifiableSet(
                    permissions != null ? new HashSet(permissions) : new HashSet<String>()),
            defaultAudience,
            FacebookSdk.getApplicationId(),
            UUID.randomUUID().toString()
    );
    request.setRerequest(AccessToken.getCurrentAccessToken() != null);
    return request;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:13,代碼來源:LoginManager.java

示例4: getLogger

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private static synchronized LoginLogger getLogger(Context context) {
    context = context != null ? context : FacebookSdk.getApplicationContext();
    if (context == null) {
        return null;
    }
    if (logger == null) {
        logger = new LoginLogger(context, FacebookSdk.getApplicationId());
    }
    return logger;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:11,代碼來源:LoginManager.java

示例5: getDialogWebFallbackUri

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private static Uri getDialogWebFallbackUri(DialogFeature feature) {
    String featureName = feature.name();
    String action = feature.getAction();
    String applicationId = FacebookSdk.getApplicationId();

    Utility.DialogFeatureConfig config =
            Utility.getDialogFeatureConfig(applicationId, action, featureName);
    Uri fallbackUrl = null;
    if (config != null) {
        fallbackUrl = config.getFallbackUrl();
    }

    return fallbackUrl;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:15,代碼來源:DialogPresenter.java

示例6: getProtocolVersionForNativeDialog

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static int getProtocolVersionForNativeDialog(
        DialogFeature feature) {
    String applicationId = FacebookSdk.getApplicationId();
    String action = feature.getAction();
    int[] featureVersionSpec = getVersionSpecForFeature(applicationId, action, feature);

    return NativeProtocol.getLatestAvailableProtocolVersionForAction(
            action,
            featureVersionSpec);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:11,代碼來源:DialogPresenter.java

示例7: setupProtocolRequestIntent

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
/**
 * Will setup the passed in Intent in the shape of a Native Protocol request Intent.
 */
public static void setupProtocolRequestIntent(
        Intent intent,
        String callId,
        String action,
        int version,
        Bundle params) {
    String applicationId = FacebookSdk.getApplicationId();
    String applicationName = FacebookSdk.getApplicationName();

    intent.putExtra(EXTRA_PROTOCOL_VERSION, version)
            .putExtra(EXTRA_PROTOCOL_ACTION, action)
            .putExtra(EXTRA_APPLICATION_ID, applicationId);

    if (isVersionCompatibleWithBucketedIntent(version)) {
        // This is a bucketed intent
        Bundle bridgeArguments = new Bundle();
        bridgeArguments.putString(BRIDGE_ARG_ACTION_ID_STRING, callId);
        Utility.putNonEmptyString(bridgeArguments, BRIDGE_ARG_APP_NAME_STRING, applicationName);

        intent.putExtra(EXTRA_PROTOCOL_BRIDGE_ARGS, bridgeArguments);

        Bundle methodArguments = (params == null) ? new Bundle() : params;
        intent.putExtra(EXTRA_PROTOCOL_METHOD_ARGS, methodArguments);
    } else {
        // This is the older flat intent
        intent.putExtra(EXTRA_PROTOCOL_CALL_ID, callId);
        if (!Utility.isNullOrEmpty(applicationName)) {
            intent.putExtra(EXTRA_APPLICATION_NAME, applicationName);
        }
        intent.putExtras(params);
    }
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:36,代碼來源:NativeProtocol.java

示例8: hasAppID

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static String hasAppID() {
    String id = FacebookSdk.getApplicationId();
    if (id == null) {
        throw new IllegalStateException("No App ID found, please set the App ID.");
    }
    return id;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:8,代碼來源:Validate.java

示例9: onResume

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onResume() {
    super.onResume();
    if (FacebookSdk.getApplicationId() != null) {
        AppEventsLogger.activateApp(this);
    }
}
 
開發者ID:lukamarin,項目名稱:Rocket.Chat-android,代碼行數:8,代碼來源:BaseActivity.java

示例10: onPause

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onPause() {
    super.onPause();
    if (FacebookSdk.getApplicationId() != null) {
        AppEventsLogger.deactivateApp(this);
    }
}
 
開發者ID:lukamarin,項目名稱:Rocket.Chat-android,代碼行數:8,代碼來源:BaseActivity.java

示例11: AccessTokenAppIdPair

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
AccessTokenAppIdPair(AccessToken accessToken) {
    this(accessToken.getToken(), FacebookSdk.getApplicationId());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:4,代碼來源:AppEventsLogger.java

示例12: getMetadataApplicationId

import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static String getMetadataApplicationId(Context context) {
    Validate.notNull(context, "context");

    FacebookSdk.sdkInitialize(context);

    return FacebookSdk.getApplicationId();
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:8,代碼來源:Utility.java


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