Google+ 是否支持从 Android 应用共享?我想知道,因为我已经在我的应用程序上为Twitter和Facebook实现了这一点,并希望为Google+做同样的事情。我确实读到他们现在有一个 API,但它仅用于开发和测试,并且无法发布应用程序。这是对的吗?
-
Google+ Android API可以在这里找到:https://developers.google.com/+/mobile/android/
-
在Google+上分享的代码片段在该页面的下方稍远 https://developers.google.com/+/mobile/android/#share_on_google:
例如,在您的 XML 中:
<Button
android:id="@+id/share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share on 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 to your app.
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);
}
});
看看Julia Ferraioli在Google Plus开发者博客上的这篇文章:
将 Android 应用中的丰富内容共享到 Google+ 及其他平台