2015-01-31 116 views
0

我想打開Facebook應用程序 - 如果安裝 - 在我牆上的帖子上(我有帖子ID),怎麼做到這一點?我嘗試了下面的代碼,但它不工作,它會導致一個異常,它只是打開Facebook應用程序,如圖所示。Android:如何在我有它的ID的帖子上打開Facebook應用程序

enter image description here

public static Intent getOpenFacebookIntent(String aPostID) { 

    try { 
     return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + aPostID)); 
    } catch (Exception e) { 
     return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + aPostID)); 
    } 
} 

編輯1:

這是一個圖的響應,當我使用video.watches並返回我不同的職位ID(這是不符合FB工作://計劃)比我發現當我懸停在我的牆上使用PC瀏覽器(這是與fb:/方案工作)的牆上後....如何獲得正確的職位ID?

enter image description here

謝謝:)

回答

2

而不是

fb://page/ 

,你將需要訪問

fb://post/{postId}?owner={uid} 

其中postId是在uid_postid格式。

希望可以幫到

+0

謝謝,uid_postid的格式是什麼?這種技術是Facebook提供的官方方式嗎? – 2015-02-02 18:03:06

+0

你能檢查我的問題在這裏有關這個問題:http://stackoverflow.com/questions/28286234/android-how-to-get-the-correct-facebook-post-id-via-graph-api-to -use-it-with-fb – 2015-02-02 21:53:34

+1

它可以讓你獲得每個帖子的ID。下劃線之前的數字基本上是發佈帖子的頁面或用戶的uid。下劃線後面的數字是postId。是的,它是由Facebook提供的。 – jogli5er 2015-02-03 07:53:32

相關問題