• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FoursquareCancelException类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.foursquare.android.nativeoauth.FoursquareCancelException的典型用法代码示例。如果您正苦于以下问题:Java FoursquareCancelException类的具体用法?Java FoursquareCancelException怎么用?Java FoursquareCancelException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FoursquareCancelException类属于com.foursquare.android.nativeoauth包,在下文中一共展示了FoursquareCancelException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCompleteFoursquareConnect

点赞 3

import com.foursquare.android.nativeoauth.FoursquareCancelException; //导入依赖的package包/类
private void onCompleteFoursquareConnect(int resultCode, Intent data) {
    AuthCodeResponse codeResponse = FoursquareOAuth.getAuthCodeFromResult(resultCode, data);
    Exception exception = codeResponse.getException();
    if (exception == null) {
        String code = codeResponse.getCode();
        registerTask = new RegisterTask(this);
        registerTask.foursquareAuthorizationCode(code).request();
    } else {
        if (exception instanceof FoursquareCancelException) toastMessage(R.string.foursquare_auth_canceled);
        else if (exception instanceof FoursquareDenyException) toastMessage(R.string.foursquare_auth_denied);
        else if (exception instanceof FoursquareOAuthException) {
            String errorMessage = exception.getMessage();
            String errorCode = ((FoursquareOAuthException) exception).getErrorCode();
            toastMessage(getString(R.string.foursquare_oauth_error_message_format, errorMessage, errorCode));
        } else toastMessage(getString(R.string.foursquare_unknown_error_message_format, exception.getMessage()));
    }
}
 

开发者ID:dan-zx,
项目名称:rox-android,
代码行数:18,
代码来源:SignInActivity.java

示例2: onCompleteConnect

点赞 2

import com.foursquare.android.nativeoauth.FoursquareCancelException; //导入依赖的package包/类
private void onCompleteConnect(int resultCode, Intent data) {
    AuthCodeResponse codeResponse = FoursquareOAuth.getAuthCodeFromResult(resultCode, data);
    Exception exception = codeResponse.getException();
    
    if (exception == null) {
        // Success.
        String code = codeResponse.getCode();
        performTokenExchange(code);
        activity.onLoggedIn(Provider.FOURSQUARE);

    } else {
        if (exception instanceof FoursquareCancelException) {
            // Cancel.
            toastMessage(activity, "Canceled");

        } else if (exception instanceof FoursquareDenyException) {
            // Deny.
        	toastMessage(activity, "Denied");
            
        } else if (exception instanceof FoursquareOAuthException) {
            // OAuth error.
            String errorMessage = exception.getMessage();
            String errorCode = ((FoursquareOAuthException) exception).getErrorCode();
            toastMessage(activity, errorMessage + " [" + errorCode + "]");
            
        } else if (exception instanceof FoursquareUnsupportedVersionException) {
            // Unsupported Fourquare app version on the device.
        	toastError(activity, exception);
            
        } else if (exception instanceof FoursquareInvalidRequestException) {
            // Invalid request.
        	toastError(activity, exception);
            
        } else {
            // Error.
        	toastError(activity, exception);
        }
    }
}
 

开发者ID:vegaen,
项目名称:UbiNomadLib,
代码行数:40,
代码来源:FourSquareConnector.java

示例3: onCompleteConnect

点赞 2

import com.foursquare.android.nativeoauth.FoursquareCancelException; //导入依赖的package包/类
private void onCompleteConnect(int resultCode, Intent data) {
	AuthCodeResponse codeResponse = FoursquareOAuth.getAuthCodeFromResult(
			resultCode, data);
	Exception exception = codeResponse.getException();

	if (exception == null) {
		// Success.
		String code = codeResponse.getCode();
		performTokenExchange(code);

	} else {
		if (exception instanceof FoursquareCancelException) {
			// Cancel.
			toastMessage(this, "Canceled");

		} else if (exception instanceof FoursquareDenyException) {
			// Deny.
			toastMessage(this, "Denied");

		} else if (exception instanceof FoursquareOAuthException) {
			// OAuth error.
			String errorMessage = exception.getMessage();
			String errorCode = ((FoursquareOAuthException) exception)
					.getErrorCode();
			toastMessage(this, errorMessage + " [" + errorCode + "]");

		} else if (exception instanceof FoursquareUnsupportedVersionException) {
			// Unsupported Fourquare app version on the device.
			toastError(this, exception);

		} else if (exception instanceof FoursquareInvalidRequestException) {
			// Invalid request.
			toastError(this, exception);

		} else {
			// Error.
			toastError(this, exception);
		}
	}
}
 

开发者ID:aliyesilkanat,
项目名称:Fake-Checkin,
代码行数:41,
代码来源:MainActivity.java

示例4: onCompleteConnect

点赞 2

import com.foursquare.android.nativeoauth.FoursquareCancelException; //导入依赖的package包/类
private void onCompleteConnect(int resultCode, Intent data) {
    AuthCodeResponse codeResponse = FoursquareOAuth.getAuthCodeFromResult(resultCode, data);
    Exception exception = codeResponse.getException();

    if (exception == null) {
        // Success.
        String code = codeResponse.getCode();
        performTokenExchange(code);

    } else {
        if (exception instanceof FoursquareCancelException) {
            // Cancel.
            Crouton.makeText(this, R.string.canceled, Style.ALERT).show();

        } else if (exception instanceof FoursquareDenyException) {
            // Deny.
            Crouton.makeText(this, R.string.denied, Style.ALERT).show();

        } else if (exception instanceof FoursquareOAuthException) {
            // OAuth error.
            String errorMessage = exception.getMessage();
            String errorCode = ((FoursquareOAuthException) exception).getErrorCode();
            Crouton.makeText(this, errorMessage + " [" + errorCode + "]", Style.ALERT).show();

        } else if (exception instanceof FoursquareUnsupportedVersionException) {
            // Unsupported Fourquare app version on the device.
            Crouton.makeText(this, exception.getMessage(), Style.ALERT).show();

        } else if (exception instanceof FoursquareInvalidRequestException) {
            // Invalid request.
            Crouton.makeText(this, exception.getMessage(), Style.ALERT).show();

        } else {
            // Error.
            Crouton.makeText(this, exception.getMessage(), Style.ALERT).show();
        }
    }
}
 

开发者ID:qbraet,
项目名称:Check-Me-In,
代码行数:39,
代码来源:LoginActivity.java

示例5: onCompleteConnect

点赞 2

import com.foursquare.android.nativeoauth.FoursquareCancelException; //导入依赖的package包/类
private void onCompleteConnect(int resultCode, Intent data) {
    AuthCodeResponse codeResponse = FoursquareOAuth.getAuthCodeFromResult(resultCode, data);
    Exception exception = codeResponse.getException();
    
    if (exception == null) {
        // Success.
        String code = codeResponse.getCode();
        performTokenExchange(code);

    } else {
        if (exception instanceof FoursquareCancelException) {
            // Cancel.
            toastMessage(this, "Canceled");

        } else if (exception instanceof FoursquareDenyException) {
            // Deny.
        	toastMessage(this, "Denied");
            
        } else if (exception instanceof FoursquareOAuthException) {
            // OAuth error.
            String errorMessage = exception.getMessage();
            String errorCode = ((FoursquareOAuthException) exception).getErrorCode();
            toastMessage(this, errorMessage + " [" + errorCode + "]");
            
        } else if (exception instanceof FoursquareUnsupportedVersionException) {
            // Unsupported Fourquare app version on the device.
        	toastError(this, exception);
            
        } else if (exception instanceof FoursquareInvalidRequestException) {
            // Invalid request.
        	toastError(this, exception);
            
        } else {
            // Error.
        	toastError(this, exception);
        }
    }
}
 

开发者ID:foursquare,
项目名称:foursquare-android-oauth,
代码行数:39,
代码来源:MainActivity.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)