本文整理汇总了Java中com.facebook.widget.FacebookDialog.PendingCall方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookDialog.PendingCall方法的具体用法?Java FacebookDialog.PendingCall怎么用?Java FacebookDialog.PendingCall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.widget.FacebookDialog
的用法示例。
在下文中一共展示了FacebookDialog.PendingCall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
if (pendingCallId == null || !pendingCallId.equals(callId)) {
return false;
}
// See if we were waiting for a dialog completion
FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
if (pendingCall == null) {
return false;
}
// Look for results
FacebookDialog.handleActivityResult(
applicationContext,
pendingCall,
requestCode,
data,
getFacebookDialogCallback(pendingCallAnalyticsBundle));
// The handlers from above will run synchronously. So by the time we get here, it should be safe to
// stop tracking this call and also serialize the controller to disk
stopTrackingPendingCall();
return true;
}
示例2: onActivityResult
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
if (pendingCallId == null || !pendingCallId.equals(callId)) {
return false;
}
// See if we were waiting for a dialog completion
FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
if (pendingCall == null) {
return false;
}
// Look for results
FacebookDialog.handleActivityResult(
context,
pendingCall,
requestCode,
data,
getFacebookDialogCallback(pendingCallAnalyticsBundle));
// The handlers from above will run synchronously. So by the time we get here, it should be safe to
// stop tracking this call and also serialize the controller to disk
stopTrackingPendingCall();
return true;
}
示例3: trackPendingDialogCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
/**
* Register that we are expecting results from a call to the Facebook application (e.g., from a native
* dialog provided by the Facebook app). Activity results forwarded to onActivityResults will be parsed
* and handled if they correspond to this call. Only a single pending FacebookDialog call can be tracked
* at a time; attempting to track another one will cancel the first one.
* @param appCall an PendingCall object containing the call ID
*/
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
if (pendingFacebookDialogCall != null) {
// If one is already pending, cancel it; we don't allow multiple pending calls.
Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call.");
cancelPendingAppCall(null);
}
pendingFacebookDialogCall = pendingCall;
}
示例4: trackPendingDialogCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
/**
* Register that we are expecting results from a call to the Facebook application (e.g., from a native
* dialog provided by the Facebook app). Activity results forwarded to onActivityResults will be parsed
* and handled if they correspond to this call. Only a single pending FacebookDialog call can be tracked
* at a time; attempting to track another one will cancel the first one.
* @param appCall an PendingCall object containing the call ID
*/
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
if (pendingFacebookDialogCallId != null) {
// If one is already pending, cancel it; we don't allow multiple pending calls.
Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call.");
cancelPendingAppCall(null);
}
if (pendingCall != null){
pendingFacebookDialogCallId = pendingCall.getCallId();
pendingFacebookDialogCallStore.trackPendingCall(pendingCall);
}
}
示例5: saveInstanceState
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public void saveInstanceState(Bundle outState) {
ArrayList<String> callIds = new ArrayList<String>(pendingCallMap.keySet());
outState.putStringArrayList(CALL_ID_ARRAY_KEY, callIds);
for(FacebookDialog.PendingCall pendingCall : pendingCallMap.values()) {
String stateKey = getSavedStateKeyForPendingCallId(pendingCall.getCallId().toString());
outState.putParcelable(stateKey, pendingCall);
}
}
示例6: trackPendingCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private void trackPendingCall(FacebookDialog.PendingCall pendingCall, Bundle analyticsParameters) {
PendingCallStore.getInstance().trackPendingCall(pendingCall);
// Save off the call id for processing the response
pendingCallId = pendingCall.getCallId();
storeObjectIdForPendingController(objectId);
// Store off the analytics parameters as well, for completion-logging
pendingCallAnalyticsBundle = analyticsParameters;
// Serialize to disk, in case we get terminated while waiting for the dialog to complete
serializeToDiskAsync(this);
}
示例7: handleFacebookDialogActivityResult
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private boolean handleFacebookDialogActivityResult(int requestCode, int resultCode, Intent data,
FacebookDialog.Callback facebookDialogCallback) {
if (pendingFacebookDialogCallId == null) {
return false;
}
FacebookDialog.PendingCall pendingCall =
pendingFacebookDialogCallStore.getPendingCallById(pendingFacebookDialogCallId);
if (pendingCall == null || pendingCall.getRequestCode() != requestCode) {
return false;
}
if (data == null) {
// We understand the request code, but have no Intent. This can happen if the called Activity crashes
// before it can be started; we treat this as a cancellation because we have no other information.
cancelPendingAppCall(facebookDialogCallback);
return true;
}
UUID callId = NativeProtocol.getCallIdFromIntent(data);
// Was this result for the call we are waiting on?
if (callId != null && pendingFacebookDialogCallId.equals(callId)) {
// Yes, we can handle it normally.
FacebookDialog.handleActivityResult(activity, pendingCall, requestCode, data,
facebookDialogCallback);
} else {
// No, send a cancellation error to the pending call and ignore the result, because we
// don't know what to do with it.
cancelPendingAppCall(facebookDialogCallback);
}
stopTrackingPendingAppCall();
return true;
}
示例8: restoreFromSavedInstanceState
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public void restoreFromSavedInstanceState(Bundle savedInstanceState) {
ArrayList<String> callIds = savedInstanceState.getStringArrayList(CALL_ID_ARRAY_KEY);
if (callIds != null) {
for (String callId : callIds) {
String stateKey = getSavedStateKeyForPendingCallId(callId);
FacebookDialog.PendingCall pendingCall = savedInstanceState.getParcelable(stateKey);
if (pendingCall != null) {
pendingCallMap.put(pendingCall.getCallId().toString(), pendingCall);
}
}
}
}
示例9: onCreate
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public void onCreate(Bundle paramBundle)
{
Session localSession1 = Session.getActiveSession();
Session localSession2 = localSession1;
if (localSession1 == null)
{
if (paramBundle != null)
localSession2 = Session.restoreSession(this.activity, null, this.callback, paramBundle);
if (localSession2 == null)
localSession2 = new Session(this.activity);
Session.setActiveSession(localSession2);
}
if (paramBundle != null)
this.pendingFacebookDialogCall = ((FacebookDialog.PendingCall)paramBundle.getParcelable("com.facebook.UiLifecycleHelper.pendingFacebookDialogCallKey"));
}
示例10: presentWebFallback
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public static boolean presentWebFallback(final Context context,
String dialogUrl,
String applicationId,
final FacebookDialog.PendingCall appCall,
final FacebookDialog.Callback callback) {
if (Utility.isNullOrEmpty(dialogUrl)) {
return false;
}
String redirectUrl = String.format("fb%s://bridge/", applicationId);
// Show the webdialog.
FacebookWebFallbackDialog fallbackWebDialog = new FacebookWebFallbackDialog(
context, dialogUrl, redirectUrl);
fallbackWebDialog.setOnCompleteListener(new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
Intent dummyIntent = new Intent();
dummyIntent.putExtras(values == null ? new Bundle() : values);
FacebookDialog.handleActivityResult(
context,
appCall,
appCall.getRequestCode(),
dummyIntent,
callback);
}
});
fallbackWebDialog.show();
return true;
}
示例11: cancelPendingAppCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
if (pendingFacebookDialogCallId == null) {
return;
}
FacebookDialog.PendingCall pendingCall =
pendingFacebookDialogCallStore.getPendingCallById(pendingFacebookDialogCallId);
if (pendingCall == null) {
return;
}
if (facebookDialogCallback != null) {
Intent pendingIntent = pendingCall.getRequestIntent();
Intent cancelIntent = new Intent();
cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);
FacebookDialog.handleActivityResult(activity, pendingCall,
pendingCall.getRequestCode(), cancelIntent, facebookDialogCallback);
}
stopTrackingPendingAppCall();
}
示例12: onComplete
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
Log.d("Facebook Dialog", "Success!");
}
示例13: trackPendingCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public void trackPendingCall(FacebookDialog.PendingCall pendingCall) {
if (pendingCall != null) {
pendingCallMap.put(pendingCall.getCallId().toString(), pendingCall);
}
}
示例14: getAppCall
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public FacebookDialog.PendingCall getAppCall() {
return appCall;
}
示例15: getPendingCallById
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public FacebookDialog.PendingCall getPendingCallById(UUID callId) {
if (callId == null) {
return null;
}
return pendingCallMap.get(callId.toString());
}