当前位置: 首页>>代码示例>>Java>>正文


Java FacebookSdk.getApplicationContext方法代码示例

本文整理汇总了Java中com.facebook.FacebookSdk.getApplicationContext方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookSdk.getApplicationContext方法的具体用法?Java FacebookSdk.getApplicationContext怎么用?Java FacebookSdk.getApplicationContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.FacebookSdk的用法示例。


在下文中一共展示了FacebookSdk.getApplicationContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllAvailableProtocolVersionsForAppInfo

import com.facebook.FacebookSdk; //导入方法依赖的package包/类
private static TreeSet<Integer> getAllAvailableProtocolVersionsForAppInfo(
        NativeAppInfo appInfo) {
    TreeSet<Integer> allAvailableVersions = new TreeSet<>();

    Context appContext = FacebookSdk.getApplicationContext();
    ContentResolver contentResolver = appContext.getContentResolver();

    String [] projection = new String[]{ PLATFORM_PROVIDER_VERSION_COLUMN };
    Uri uri = buildPlatformProviderVersionURI(appInfo);
    Cursor c = null;
    try {
        c = contentResolver.query(uri, projection, null, null, null);
        if (c != null) {
            while (c.moveToNext()) {
                int version = c.getInt(c.getColumnIndex(PLATFORM_PROVIDER_VERSION_COLUMN));
                allAvailableVersions.add(version);
            }
        }
    } finally {
        if (c != null) {
            c.close();
        }
    }

    return allAvailableVersions;
}
 
开发者ID:CE-KMITL-OOAD-2015,项目名称:Move-Alarm_ORCA,代码行数:27,代码来源:NativeProtocol.java

示例2: logShareResult

import com.facebook.FacebookSdk; //导入方法依赖的package包/类
private static void logShareResult(String shareOutcome, String errorMessage) {
    Context context = FacebookSdk.getApplicationContext();
    AppEventsLogger logger = AppEventsLogger.newLogger(context);
    Bundle parameters = new Bundle();
    parameters.putString(
            AnalyticsEvents.PARAMETER_SHARE_OUTCOME,
            shareOutcome
    );

    if (errorMessage != null) {
        parameters.putString(AnalyticsEvents.PARAMETER_SHARE_ERROR_MESSAGE, errorMessage);
    }
    logger.logSdkEvent(AnalyticsEvents.EVENT_SHARE_RESULT, null, parameters);
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:15,代码来源:ShareInternalUtility.java

示例3: 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

示例4: fetchAllAvailableProtocolVersionsForAppInfo

import com.facebook.FacebookSdk; //导入方法依赖的package包/类
private static TreeSet<Integer> fetchAllAvailableProtocolVersionsForAppInfo(
        NativeAppInfo appInfo) {
    TreeSet<Integer> allAvailableVersions = new TreeSet<>();

    Context appContext = FacebookSdk.getApplicationContext();
    ContentResolver contentResolver = appContext.getContentResolver();

    String [] projection = new String[]{ PLATFORM_PROVIDER_VERSION_COLUMN };
    Uri uri = buildPlatformProviderVersionURI(appInfo);
    Cursor c = null;
    try {
        // First see if the base provider exists as a check for whether the native app is
        // installed. We do this prior to querying, to prevent errors from being output to
        // logcat saying that the provider was not found.
        PackageManager pm = FacebookSdk.getApplicationContext().getPackageManager();
        String contentProviderName = appInfo.getPackage() + PLATFORM_PROVIDER;
        ProviderInfo pInfo = pm.resolveContentProvider(contentProviderName, 0);
        if (pInfo != null) {
            c = contentResolver.query(uri, projection, null, null, null);
            if (c != null) {
                while (c.moveToNext()) {
                    int version = c.getInt(c.getColumnIndex(PLATFORM_PROVIDER_VERSION_COLUMN));
                    allAvailableVersions.add(version);
                }
            }
        }

        return allAvailableVersions;
    } finally {
        if (c != null) {
            c.close();
        }
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:35,代码来源:NativeProtocol.java

示例5: setupAppCallForNativeDialog

import com.facebook.FacebookSdk; //导入方法依赖的package包/类
public static void setupAppCallForNativeDialog(
        AppCall appCall,
        ParameterProvider parameterProvider,
        DialogFeature feature) {
    Context context = FacebookSdk.getApplicationContext();
    String action = feature.getAction();
    int protocolVersion = getProtocolVersionForNativeDialog(feature);
    if (protocolVersion == NativeProtocol.NO_PROTOCOL_AVAILABLE) {
        throw new FacebookException(
                "Cannot present this dialog. This likely means that the " +
                        "Facebook app is not installed.");
    }

    Bundle params;
    if (NativeProtocol.isVersionCompatibleWithBucketedIntent(protocolVersion)) {
        // Facebook app supports the new bucketed protocol
        params = parameterProvider.getParameters();
    } else {
        // Facebook app only supports the old flat protocol
        params = parameterProvider.getLegacyParameters();
    }
    if (params == null) {
        params = new Bundle();
    }

    Intent intent = NativeProtocol.createPlatformActivityIntent(
            context,
            appCall.getCallId().toString(),
            action,
            protocolVersion,
            params);
    if (intent == null) {
        throw new FacebookException(
                "Unable to create Intent; this likely means the" +
                        "Facebook app is not installed.");
    }

    appCall.setRequestIntent(intent);
}
 
开发者ID:CE-KMITL-OOAD-2015,项目名称:Move-Alarm_ORCA,代码行数:40,代码来源:DialogPresenter.java

示例6: getQueryParamsForPlatformActivityIntentWebFallback

import com.facebook.FacebookSdk; //导入方法依赖的package包/类
public static Bundle getQueryParamsForPlatformActivityIntentWebFallback(
        String callId,
        int version,
        Bundle methodArgs) {

    Context context = FacebookSdk.getApplicationContext();
    String keyHash = FacebookSdk.getApplicationSignature(context);
    if (Utility.isNullOrEmpty(keyHash)) {
        return null;
    }

    Bundle webParams = new Bundle();

    webParams.putString(FALLBACK_DIALOG_PARAM_KEY_HASH, keyHash);
    webParams.putString(FALLBACK_DIALOG_PARAM_APP_ID, FacebookSdk.getApplicationId());
    webParams.putInt(FALLBACK_DIALOG_PARAM_VERSION, version);
    webParams.putString(DIALOG_PARAM_DISPLAY, FALLBACK_DIALOG_DISPLAY_VALUE_TOUCH);

    Bundle bridgeArguments = new Bundle();
    bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_ACTION_ID_STRING, callId);

    methodArgs = (methodArgs == null) ? new Bundle() : methodArgs;

    try {
        JSONObject bridgeArgsJSON = BundleJSONConverter.convertToJSON(bridgeArguments);
        JSONObject methodArgsJSON = BundleJSONConverter.convertToJSON(methodArgs);

        if (bridgeArgsJSON == null || methodArgsJSON == null) {
            return null;
        }

        webParams.putString(FALLBACK_DIALOG_PARAM_BRIDGE_ARGS, bridgeArgsJSON.toString());
        webParams.putString(FALLBACK_DIALOG_PARAM_METHOD_ARGS, methodArgsJSON.toString());
    } catch (JSONException je) {
        webParams = null;
        Logger.log(LoggingBehavior.DEVELOPER_ERRORS, Log.ERROR, TAG,
                "Error creating Url -- " + je);
    }

    return webParams;
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:42,代码来源:ServerProtocol.java


注:本文中的com.facebook.FacebookSdk.getApplicationContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。