2011-09-23 21 views
1

我正在使用我的Android應用程序進行Facebook集成。我可以通過使用「stream.publish」打開對話框發送附件。有沒有打開對話框發佈的方式? 我正在使用以下方法。使用Facebook Android SDK發佈沒有打開對話框的附件?

請給我任何想法。

  postParams.put("seriesname", "Commented during the TV show"+" '"+series+"'"); 
      postParams.put("description", text); 
      parameters.putString("attachment", "{\"name\":\""+postParams.get("seriesname")+"\"," 
        +"\"href\":\""+"http://www.google.com\","+"\"description\":\""+postParams.get("description")+"\"}"); 

      mFacebook.dialog(FacebookComments.this, "stream.publish", parameters, new SampleDialogListener()); 
      Log.d("FACEBOOK RESPONSE", response); 
      if (response == null || response.equals("") 
        || response.equals("false")) { 
       Log.v("Error", "Blank response"); 
      } 
     } 
    } catch (Exception e) { 
     Log.e("Facebook", "Error: " + e.getMessage()); 
    } 
} 
+0

我更新了我的answer..check它。 – Venky

回答

3

檢查這個代碼在Facebook塗鴉牆上張貼不含對話框:

public boolean postOnWall(String msg) { 
    Log.d("Tests", "Testing graph API wall post"); 
    try { 
     String response; 
     Bundle parameters = new Bundle(); 
     parameters.putString("message", msg); 
     parameters.putString("description", "test test test"); 
     parameters.putString("tags",person_id); 
     response = ZValues.authenticatedFacebook.request("me/feed", parameters,"POST"); 
     Log.d("Tests", "got response: " + response); 
     if (response == null || response.equals("") || response.equals("false")) { 
      Log.v("Error", "Blank response"); 
      return false; 
     } 
    } catch(Exception e) { 
     e.printStackTrace(); 
    } 
    return true; 
} 

入住這for sending links in Post

+0

@Chandra Reddy如果你發現這個答案是有用的,只需添加聲譽,如果你的問題解決了就接受我的答案.. – Venky

+0

謝謝你的答覆Venky。通過使用Facebook Graph API,我無法發佈附件。我想在Facebook牆上張貼附件(使用自定義鏈接),無需打開對話框。如果您有任何想法,請告訴我。 –

+2

是否有任何替代方法可以在不使用「stream.publish」打開對話框的情況下發布附件?以及爲什麼Graph API不支持附件? –

相關問題