3

サーバーから画像を投稿し、Android アプリケーションから Google プラスの両方に URL をリンクしようとしましたが、両方を Google プラスに投稿することはできません..

私は投稿するためにこのコードを試しました..

Intent shareIntent = new 

PlusShare.Builder(GooglePlusActivity.this)
                  .setType("text/plain")
                  .setText("Welcome to the Google+ platform....")

                  .setContentDeepLinkId("/cheesecake/lemon", 
                          "Lemon Cheesecake recipe", 
                          "A tasty recipe for making lemon cheesecake.",
                          Uri.parse("http://www.onedigital.mx/ww3/wp-content/uploads/2012/02/android-420x315.jpg"))
                  .setContentUrl(Uri.parse("https://developers.google.com/+/"))
                  .getIntent();`

このコードでは、画像のみを投稿し、URL を投稿していません。URL は表示されますが、クリックできません。

誰かが私の問題の解決策を教えてくれます..

4

3 に答える 3

3

google-play-services_libライブラリ プロジェクトが必要です。プロジェクトに追加してワークスペースにインポートするだけです。

.../android-sdk-linux_x86/extras/google/google_play_services/libprojectで見つけることができます

そして、このコードを使用して、google-plus アプリケーションを介して google-plus で共有します。

final int errorCode = GooglePlusUtil.checkGooglePlusApp(mActivity);
if (errorCode == GooglePlusUtil.SUCCESS) {
// Invoke the ACTION_SEND intent to share to Google+ with attribution.
Intent shareIntent = ShareCompat.IntentBuilder.from(mActivity)
                                .setText("")
                                .setType("text/plain")
                                .getIntent()
                                .setPackage("com.google.android.apps.plus");
    startActivity(shareIntent);
} else {
    Toast.makeText(mActivity, "Google plus not installed", Toast.LENGTH_LONG).show();
}
于 2013-08-17T11:20:06.547 に答える
1

解決策は、画像を共有し、付随するテキストで URL を提供することです。PlusShare のドキュメントを参照してください。

https://developers.google.com/+/mobile/android/share/media

それは言う:メディアをGoogle+に共有するとき、setContentUrlメソッドも使用できません。メディアと一緒に投稿に URL を含めたい場合は、setText() メソッドで事前に入力されたテキストに URL を追加する必要があります。

于 2014-01-30T17:54:38.787 に答える