【问题标题】:how to share via Google+ from mobile app in android?如何通过 Android 移动应用程序通过 Google+ 分享?
【发布时间】:2014-03-06 11:11:52
【问题描述】:

如何通过google plus在android中分享,请发送代码和详细信息。

Intent gplus = ShareCompat.IntentBuilder.from(MainActivity.this)
        .setText("This site has lots of great information about  Android!http://www.android.com")
        .setType("text/plain")
        .getIntent()
        .setPackage("com.google.android.apps.plus");

 startActivity(gplus);

我尝试使用上面的代码通过 google plus 在 android 中执行共享..但是当我运行此代码时我的应用程序崩溃了...请帮助我执行..

【问题讨论】:

    标签: android android-intent android-listview android-fragments


    【解决方案1】:

    尝试在移动设备上运行。如果您在模拟器中运行您的应用程序,则没有 google-play 服务库。所以在真实设备上运行你的应用程序。

    【讨论】:

    • 确保您的应用包含 google play services 库并且您的设备包含已安装的 google play services apk
    • google play 服务库是什么意思..??如何安装这个 apk...请用教程或链接或代码指导我...我对 android 完全陌生...
    【解决方案2】:

    试试下面的代码...

    // 启动 Google+ 分享对话框并注明您的应用。

     Intent shareIntent = new PlusShare.Builder(MainActivity.this)
                          .setType("text/plain")
                          .setText("YOUR TEXT HERE")
                          .setContentUrl(Uri.parse("YOUR LINK HERE"))
                          .getIntent();
    
                      startActivityForResult(shareIntent, 0);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-04
      • 2023-03-28
      相关资源
      最近更新 更多