PlusShare类已弃用。还有其他选择在Android应用程序上分享谷歌加吗?

问题描述 投票:0回答:1

我想在我的Android应用中集成Google plus并将我的应用中的帖子分享给Google Plus。为此,我正在关注它的documentation。在该文档中,以下代码在google plus上分享:

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);

但是,问题是PlusShare类被弃用了。所以,我的问题是,是否有其他方法或其他方式在Google Plus上分享帖子?

注意:从我的应用程序共享帖子工作正常。

android google-plus
1个回答
2
投票

我找到了另一种方法。这是以下面的方式。

Intent shareIntent = ShareCompat.IntentBuilder.from(this)
                .setText("your Text")
                .setType("text/plain")
                .getIntent()
                .setPackage("com.google.android.apps.plus");

startActivityForResult(shareIntent, GOOGLE_REQUEST_SHARE);
© www.soinside.com 2019 - 2024. All rights reserved.