2012-08-09 53 views
2

我需要Google+中的分享鏈接。在文檔中,我看到了以下代碼:在Google+上分享

Button shareButton = (Button) findViewById(R.id.share_button); 
shareButton.setOnClickListener(new OnClickListener() 
{ 
    @Override 
    public void onClick(View v) 
    { 
     // Launch the Google+ share dialog with attribution. 
     Intent shareIntent = ShareCompat.IntentBuilder.from(ExampleActivity.this) 
      .setType("text/plain") 
      .setText("Welcome to the Google+ platform. https://developers.google.com/+") 
      .getIntent() 
      .setPackage("com.google.android.apps.plus"); 

     startActivity(shareIntent); 
    } 
}); 

但是,如果在我的手機上是官方客戶端Google+,它將起作用。我可以在Google+中分享鏈接,而無需使用官方客戶端。

+0

是的,但你必須有谷歌+ API。 – Gorets 2012-08-09 11:54:45

+0

我沒有找到它是怎麼回事的:(。 – Vladimir 2012-08-09 11:56:57

+0

http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API – Gorets 2012-08-09 12:00:42

回答

0

共享意圖,顯示在您提供的代碼中。使用原生的Google+應用程序將內容分享到Google+。這是在Android上將內容分享到Google+的唯一方式。