2012-04-29 16 views
0

我需要一些建議這件事...... 我用Facebook的Android SDK中創建從我的應用Facebook的整合......我跟着這個教程: http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/安卓定製的Facebook的整合

我會需要在一個活動中實現身份驗證,而在另一個活動中實現身份驗證postToWall ....身份驗證後,我只想通過按按鈕發送帖子,但是在其他活動中,與執行身份驗證的活動不同。

是否有可能?或者在SDK中,我被迫在同一活動中一起做所有事情?

在此先感謝

回答

0

是的,這是可能的。你會得到一個訪問令牌,你可以發送到下一個活動。使用getAccessToken()和setAccessToken()。

這裏,即使保存所需要的數據爲例:Contact-Picture-Sync

0

你需要安裝一個擴展,類似核心的Android SDK,但是沒有,這裏是你需要做什麼:

1 。)去github.com/facebook/facebook-android-sdk

2.)只下載facebook目錄!其他目錄只是例子。

3)從SRC把文件(可以複製可繪製也一樣,如果你願意的話)的包,你正在與

4)你是好樣的工作去,你可以使用Facebook「SDK」

又見這個例子https://github.com/facebook/facebook-android-sdk/tree/master/examples/Hackbook下載它,它正在例如通過Facebook的

0

提供只是提供一個備選答案,還有在Android上實現共享的其他方式。

它允許更多的分享選項(如Twitter,QR條碼,博客和whatnot),而無需處理Facebook的Android SDK。

什麼你會用一個「共享」的意圖,就像這樣:

String title = "My thing"; // used if you share through email or channels that require a headline for the content, always include this or some apps might not parse the content right 

String wallPost = "Hey - check out this stuff: http://link.com "; // the content of your wallpost 

String shareVia = "Share this stuff via"; // the headline for your chooser, where the phones avaliable sharing mechanisms are offered. 

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); 
      shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
      shareIntent.setType("text/plain"); 


shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title); 

shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, wallPost); 

startActivity(Intent.createChooser(shareIntent, shareVia)); 

這是目前爲止Android上的首選解決方案,如果你正在尋找簡單的分享,因爲它使你的應用程序面向未來與新服務兼容。而且對用戶來說也更加精簡和靈活,因爲從分享按鈕到發佈內容幾乎沒有任何摩擦。

也可以在這個博客中看到:http://android-developers.blogspot.com/2012/02/share-with-intents.html

我希望你可以使用此爲您的項目。