代码之家  ›  专栏  ›  技术社区  ›  Riddhi

PlusShare类已弃用。在android应用程序的google Plus上,还有其他选择吗?

  •  0
  • Riddhi  · 技术社区  · 6 年前

    我想在我的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

    注意:从我的应用程序分享帖子是完美的工作。

    1 回复  |  直到 6 年前
        1
  •  2
  •   Riddhi    6 年前

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

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