2013-05-06 23 views
2

哥們我跟隨api-doc在這裏https://developers.google.com/+/mobile/android/getting-started,因爲他們告訴我在apis/console註冊應用程序,我註冊並獲得客戶端ID,但不知道在哪裏使用此ID。如何發佈在谷歌加上,得到ActivityNotFoundException

我想張貼在牆上(數據流)編程,我得到了一個例子在這個文檔如下面的代碼

Intent shareIntent = new PlusShare.Builder(this) 
    .setType("text/plain") 
    .setText("Welcome to the Google+ platform.") 
    .setContentUrl(Uri.parse("https://developers.google.com/+/")) 
    .getIntent(); 
startActivityForResult(shareIntent,0); 

但是當我運行它,我得到ActivityNotFound Exception,可以請你告訴我,我怎樣才能解決它,
如果您需要更多關於我的問題的信息,我可以在這裏分享我的代碼。由於

回答

1

隨着你越來越ActivityNotFoundException,這意味着你要麼不具備這樣的活動或沒有註冊的,
現在我覺得你不用它。因此,請確保您的手機中已安裝Google +應用程序,如果沒有,請先安裝它,然後運行它,然後它將顯示所需的活動。

+0

是Umesh製作我沒有谷歌+應用程序。 – Raja 2013-05-07 12:42:23

+0

好吧,然後從谷歌播放它,免費的 – umesh 2013-05-07 12:43:15

7

要澄清一點,您不能自動共享。用戶確實可以控制共享並確認共享和內容。

您應該在啓動分享意向之前check that the user has the Google+ app installed and not disabled

int errorCode = GooglePlusUtil.checkGooglePlusApp(this); 
if (errorCode != GooglePlusUtil.SUCCESS) { 
    GooglePlusUtil.getErrorDialog(errorCode, this, 0).show(); 
} 

GooglePlusUtil是在谷歌Play服務SDK

+0

我不能使用GooglePlusUtil.Because它說GooglePlusUtil找不到。我在我的項目中導入了Google Play服務SDK。 – Ponting 2013-08-19 09:31:13

相關問題