本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例9: onResume
import com.facebook.FacebookSdk; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (FacebookSdk.getApplicationId() != null) {
AppEventsLogger.activateApp(this);
}
}
示例10: onPause
import com.facebook.FacebookSdk; //导入方法依赖的package包/类
@Override
protected void onPause() {
super.onPause();
if (FacebookSdk.getApplicationId() != null) {
AppEventsLogger.deactivateApp(this);
}
}
示例11: AccessTokenAppIdPair
import com.facebook.FacebookSdk; //导入方法依赖的package包/类
AccessTokenAppIdPair(AccessToken accessToken) {
this(accessToken.getToken(), FacebookSdk.getApplicationId());
}
示例12: getMetadataApplicationId
import com.facebook.FacebookSdk; //导入方法依赖的package包/类
public static String getMetadataApplicationId(Context context) {
Validate.notNull(context, "context");
FacebookSdk.sdkInitialize(context);
return FacebookSdk.getApplicationId();
}