[英]Sharing to Google+ from Android
Does Google+ support sharing from an Android app yet? Google+是否支持从Android应用共享? I wanted to know because I have implemented this for twitter and facebook on my app and would like to do the same for Google+.
我想知道,因为我已经在我的应用程序中为twitter和facebook实现了此功能,并且希望对Google+也是如此。 I did read that they have an API now but it's only for development and testing and apps cannot be published.
我确实读过他们现在有一个API,但这仅用于开发和测试,并且无法发布应用。 Is this correct?
这个对吗?
The Google+ Android API can be found here: https://developers.google.com/+/mobile/android/ 您可以在以下位置找到Google+ Android API: https : //developers.google.com/+/mobile/android/
The code snippet for sharing on Google+ is a little ways down that page https://developers.google.com/+/mobile/android/#share_on_google : 在Google+上共享的代码段距该页面https://developers.google.com/+/mobile/android/#share_on_google有点距离:
For example, in your XML: 例如,在您的XML中:
<Button
android:id="@+id/share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share on Google+" />
In your Activity: 在您的活动中:
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);
}
});
Take a peek at this post from Julia Ferraiol i on the Google Plus developer blog : 快看一下Google Plus开发者博客上来自Julia Ferraiol i的这篇文章 :
Sharing Rich Content From Your Android Apps, to Google+ and Beyond 将丰富的内容从您的Android应用共享到Google+及其他
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.