本文整理匯總了Java中com.facebook.widget.WebDialog.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java WebDialog.Builder方法的具體用法?Java WebDialog.Builder怎麽用?Java WebDialog.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.widget.WebDialog
的用法示例。
在下文中一共展示了WebDialog.Builder方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tryAuthorize
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
applicationId = request.getApplicationId();
Bundle parameters = new Bundle();
if (!Utility.isNullOrEmpty(request.getPermissions())) {
String scope = TextUtils.join(",", request.getPermissions());
parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
}
String previousToken = request.getPreviousAccessToken();
if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
// Don't log the actual access token, just its presence or absence.
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
} else {
// The call to clear cookies will create the first instance of CookieSyncManager if necessary
Utility.clearFacebookCookies(context);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
onWebDialogComplete(request, values, error);
}
};
e2e = getE2E();
addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);
WebDialog.Builder builder =
new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
.setE2E(e2e)
.setOnCompleteListener(listener);
loginDialog = builder.build();
loginDialog.show();
return true;
}
示例2: tryAuthorize
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
String applicationId = request.getApplicationId();
Bundle parameters = new Bundle();
if (!Utility.isNullOrEmpty(request.getPermissions())) {
parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, TextUtils.join(",", request.getPermissions()));
}
String previousToken = request.getPreviousAccessToken();
if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
} else {
// The call to clear cookies will create the first instance of CookieSyncManager if necessary
Utility.clearFacebookCookies(context);
}
WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
onWebDialogComplete(request, values, error);
}
};
WebDialog.Builder builder =
new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
.setOnCompleteListener(listener);
loginDialog = builder.build();
loginDialog.show();
return true;
}
示例3: tryAuthorize
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
applicationId = request.getApplicationId();
Bundle parameters = new Bundle();
if (!Utility.isNullOrEmpty(request.getPermissions())) {
String scope = TextUtils.join(",", request.getPermissions());
parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
}
String previousToken = request.getPreviousAccessToken();
if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
// Don't log the actual access token, just its presence or absence.
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
} else {
// The call to clear cookies will create the first instance of CookieSyncManager if necessary
Utility.clearFacebookCookies(context);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
onWebDialogComplete(request, values, error);
}
};
e2e = getE2E();
addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);
WebDialog.Builder builder =
new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
.setE2E(e2e)
.setIsRerequest(request.isRerequest())
.setOnCompleteListener(listener);
loginDialog = builder.build();
loginDialog.show();
return true;
}
示例4: tryAuthorize
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
applicationId = request.getApplicationId();
Bundle parameters = new Bundle();
if (!Utility.isNullOrEmpty(request.getPermissions())) {
String scope = TextUtils.join(",", request.getPermissions());
parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
}
SessionDefaultAudience audience = request.getDefaultAudience();
parameters.putString(ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());
String previousToken = request.getPreviousAccessToken();
if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
// Don't log the actual access token, just its presence or absence.
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
} else {
// The call to clear cookies will create the first instance of CookieSyncManager if necessary
Utility.clearFacebookCookies(context);
addLoggingExtra(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
onWebDialogComplete(request, values, error);
}
};
e2e = getE2E();
addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);
WebDialog.Builder builder =
new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
.setE2E(e2e)
.setIsRerequest(request.isRerequest())
.setOnCompleteListener(listener);
loginDialog = builder.build();
loginDialog.show();
return true;
}