本文整理匯總了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();
}