안드로이드 소스
public void SendFeed( ) { Handler m_FacebookHandler = new Handler(); m_FacebookHandler.post(new Runnable() { public void run() { Bundle params = new Bundle(); params.putString("name", "Rolling Cat"); params.putString("caption", "Now Download"); params.putString("description", "Rolling Rolling Cat~!" ); params.putString("picture", "http://54.76.113.24/rollingcaticon.png" ); params.putString("link", "http://54.76.113.24/rollingcatlink.htm"); showDialogWithoutNotificationBar("feed", params); } }); } private void showDialogWithoutNotificationBar(String action, Bundle params) { WebDialog mWebDialog = new WebDialog.Builder(mActivity, Session.getActiveSession(), action, params).setOnCompleteListener(new WebDialog.OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { if (error != null && !(error instanceof FacebookOperationCanceledException)) { } mWebDialog = null; mDialogAction = null; mDialogmParams = null; //ds5623 1128 if(values != null) mNotification = NOTIFICATION_STATE.NOTIFICATION_OK; else mNotification = NOTIFICATION_STATE.NOTIFICATION_CANCLE; } }).build(); Window dialog_window = mWebDialog.getWindow(); dialog_window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); mDialogAction = action; mDialogmParams = params; //ds5623 1128 mNotification = NOTIFICATION_STATE.NOTIFICATION_OPEN; mWebDialog.show(); }
아이폰 IOS 소스
- (void)SendFeed { // Check if the Facebook app is installed and we can present the share dialog FBLinkShareParams *params = [[FBLinkShareParams alloc] init]; params.link = [NSURL URLWithString:@"http://54.76.113.24/rollingcatlink.htm"]; // If the Facebook app is installed and we can present the share dialog if ([FBDialogs canPresentShareDialogWithParams:params]) { // Present share dialog [FBDialogs presentShareDialogWithLink:params.link handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { if(error) { // An error occurred, we need to handle the error // See: https://developers.facebook.com/docs/ios/errors NSLog(@"Error publishing story: %@", error.description); } else { // Success NSLog(@"result %@", results); } }]; // If the Facebook app is NOT installed and we can't present the share dialog } else { NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"Rolling Cat", @"name", @"Noew Download", @"caption", @"Allow your users to share stories on Facebook from your app using the iOS SDK.", @"description", @"http://54.76.113.24/rollingcatlink.htm", @"link", @"http://54.76.113.24/rollingcaticon.png", @"picture", nil]; [FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { if (error) { NSLog(@"Error publishing story: %@", error.description); } else { if (result == FBWebDialogResultDialogNotCompleted) { NSLog(@"User cancelled."); } else { NSLog(@"Success."); /* NSDictionary *urlParams = [self parseURLParams:[resultURL query]]; if (![urlParams valueForKey:@"post_id"]) { NSLog(@"User cancelled."); } else { NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]]; NSLog(@"result %@", result); } */ } } }]; } }
댓글 없음 :
댓글 쓰기